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.
6 # See README-fixinc for more information.
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}}
12 # Directory in which to store the results.
13 LIB
=${1?"fixincludes: output directory not specified"}
15 # Define PWDCMD as a command to use to get the working dir
16 # in the form that we want.
20 # On an Apollo, discard everything before `/usr'.
21 PWDCMD
="eval pwd | sed -e 's,.*/usr/,/usr/,'"
28 # Make sure it exists.
29 if [ ! -d $LIB ]; then
33 # Make LIB absolute only if needed to avoid problems with the amd.
38 cd $LIB; LIB
=`${PWDCMD}`
42 # Fail if no arg to specify a directory for the output.
44 then echo fixincludes
: no output directory specified
48 echo Building fixed headers
in ${LIB}
50 # Determine whether this system has symbolic links.
51 if ln -s X
$LIB/ShouldNotExist
2>/dev
/null
; then
52 rm -f $LIB/ShouldNotExist
54 elif ln -s X
/tmp
/ShouldNotExist
2>/dev
/null
; then
55 rm -f /tmp
/ShouldNotExist
61 echo Finding directories and links to directories
63 # Find all directories and all symlinks that point to directories.
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.
71 while [ -n "$dirs" ] && [ $levels -gt 0 ]
73 levels
=`expr $levels - 1`
77 echo " Searching $INPUT/$d"
79 # Find all directories under $d, relative to $d, excluding $d itself.
80 # (The /. is needed after $d in case $d is a symlink.)
81 files
="$files `find $d/. -type d -print | \
82 sed -e '/\/\.$/d' -e 's@/./@/@g'`"
83 # Find all links to directories.
84 # Using `-exec test -d' in find fails on some systems,
85 # and trying to run test via sh fails on others,
86 # so this is the simplest alternative left.
87 # First find all the links, then test each one.
90 theselinks
=`find $d/. -type l -print | sed -e 's@/./@/@g'`
91 for d1
in $theselinks --dummy--
93 # If the link points to a directory,
94 # add that dir to $newdirs
98 if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
100 newdirs
="$newdirs $d1"
110 echo "All directories (including links to directories):"
113 for file in $files; do
115 if [ ! -d $LIB/$file ]
116 then mkdir
$LIB/$file
121 # treetops gets an alternating list
122 # of old directories to copy
123 # and the new directories to copy to.
124 treetops
="${INPUT} ${LIB}"
127 echo 'Making symbolic directory links'
128 for file in $files; do
129 dest
=`ls -ld $file | sed -n 's/.*-> //p'`
132 # In case $dest is relative, get to $file's dir first.
134 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
135 # Check that the target directory exists.
136 # Redirections changed to avoid bug in sh on Ultrix.
137 (cd $dest) > /dev
/null
2>&1
140 # X gets the dir that the link actually leads to.
142 # Canonicalize ${INPUT} now to minimize the time an
143 # automounter has to change the result of ${PWDCMD}.
144 cinput
=`cd ${INPUT}; ${PWDCMD}`
145 # If a link points to ., make a similar link to .
146 if [ $x = ${cinput} ]; then
147 echo $file '->' .
': Making link'
148 rm -fr ${LIB}/$file > /dev
/null
2>&1
149 ln -s .
${LIB}/$file > /dev
/null
2>&1
150 # If link leads back into ${INPUT},
151 # make a similar link here.
152 elif expr $x : "${cinput}/.*" > /dev
/null
; then
153 # Y gets the actual target dir name, relative to ${INPUT}.
154 y
=`echo $x | sed -n "s&${cinput}/&&p"`
155 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
157 sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
158 echo $file '->' $dots$y ': Making link'
159 rm -fr ${LIB}/$file > /dev
/null
2>&1
160 ln -s $dots$y ${LIB}/$file > /dev
/null
2>&1
162 # If the link is to a dir $target outside ${INPUT},
163 # repoint the link at ${INPUT}/root$target
164 # and process $target into ${INPUT}/root$target
165 # treat this directory as if it actually contained the files.
166 echo $file '->' root
$x ': Making link'
167 if [ -d $LIB/root
$x ]
173 while [ x
$dirname != x
]; do
174 component
=`echo $dirname | sed -e 's|/.*$||'`
175 mkdir
$component >/dev
/null
2>&1
177 dirmade
=$dirmade/$component
178 dirname=`echo $dirname | sed -e 's|[^/]*/||'`
181 # Duplicate directory structure created in ${LIB}/$file in new
183 for file2
in $files; do
186 dupdir
=${LIB}/root
$x/`echo $file2 | sed -n "s|^${file}/||p"`
187 echo "Duplicating ${file}'s ${dupdir}"
198 # Get the path from ${LIB} to $file, accounting for symlinks.
199 parent
=`echo "$file" | sed -e 's@/[^/]*$@@'`
200 libabs
=`cd ${LIB}; ${PWDCMD}`
201 file2
=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
202 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
203 dots
=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
204 rm -fr ${LIB}/$file > /dev
/null
2>&1
205 ln -s ${dots}root
$x ${LIB}/$file > /dev
/null
2>&1
206 treetops
="$treetops $x ${LIB}/root$x"
217 while [ $# != 0 ]; do
218 # $1 is an old directory to copy, and $2 is the new directory to copy to.
221 # The same dir can appear more than once in treetops.
222 # There's no need to scan it more than once.
228 echo Fixing directory
$1 into
$2
229 # Check .h files which are symlinks as well as those which are files.
230 # A link to a header file will not be processed by anything but this.
232 files
=`find . -name '*.h' \( -type f -o -type l \) -print`
234 files
=`find . -name '*.h' -type f -print`
236 echo Checking header files
238 # Note that BSD43_* are used on recent MIPS systems.
239 for file in $files; do
240 # This call to egrep is essential, since checking a file with egrep
241 # is much faster than actually trying to fix it.
242 # It is also essential that most files *not* match!
243 # Thus, matching every #endif is unacceptable.
244 # But the argument to egrep must be kept small, or many versions of egrep
245 # won't be able to handle it.
247 # We use the pattern [!-.0-~] instead of [^/ ] to match a noncomment
248 # following #else or #endif because some buggy egreps think [^/] matches
249 # newline, and they thus think `#else ' matches `#e[ndiflse]*[ ]+[^/ ]'.
251 # We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
252 # following #if or #elif that is not surrounded by __. The `a-ce-km-z'
253 # in this pattern lacks `d' and `l'; this means we don't worry about
254 # identifiers starting with `d' or `l'. This is OK, since none of the
255 # identifiers below start with `d' or `l'. It also greatly improves
256 # performance, since many files contain lines of the form `#if ... defined ...'
258 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
259 if [ -r $file ]; then
260 cp $file $2/$file >/dev
/null
2>&1 \
261 ||
echo "Can't copy $file"
264 # The fixinc_eol stuff is to work around a bug in the sed
265 # program on HP/UX 10.20.
266 # Here is how the sed commands in braces work.
267 # (It doesn't work to put the comments inside the sed commands.)
268 # Surround each word with spaces, to simplify matching below.
269 # ANSIfy each pre-ANSI machine-dependent symbol
270 # by surrounding it with __ __.
271 # Remove the spaces that we inserted around each word.
275 s/\\$/\\*fixinc_eol*/
277 s/\\\*fixinc_eol\*/\\/g
278 s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
279 s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%
280 s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
281 s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
282 s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%
283 /\/\/[^*]/ s|//\(.*\)$|/*\1*/|
284 /[ ]_IO[A-Z]*[ ]*(/ s/\(_IO[A-Z]*[ ]*(\)\(.\),/\1'\''\2'\'',/
285 /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
286 /#define._IO/ s/'\''\([cgxtf]\)'\''/\1/g
287 /#define.BSD43__IO/ s/'\''\([cgx]\)'\''/\1/g
288 /[^A-Z0-9_]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
289 /[^A-Z0-9]_CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
290 /#define[ ]*[ ]CTRL/ s/'\''\([cgx]\)'\''/\1/g
291 /#define[ ]*[ ]_CTRL/ s/'\''\([cgx]\)'\''/\1/g
292 /#define.BSD43_CTRL/ s/'\''\([cgx]\)'\''/\1/g
294 s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
296 s/ bsd4\([0-9]\) / __bsd4\1__ /g
297 s/ _*host_mips / __host_mips__ /g
298 s/ _*i386 / __i386__ /g
300 s/ is68k / __is68k__ /g
301 s/ m68k / __m68k__ /g
302 s/ mc680\([0-9]\)0 / __mc680\10__ /g
303 s/ m88k / __m88k__ /g
304 s/ _*mips / __mips__ /g
305 s/ news\([0-9]*\) / __news\1__ /g
306 s/ ns32000 / __ns32000__ /g
307 s/ pdp11 / __pdp11__ /g
310 s/ sony_news / __sony_news__ /g
311 s/ sparc / __sparc__ /g
312 s/ sun\([a-z0-9]*\) / __sun\1__ /g
313 s/ tahoe / __tahoe__ /g
314 s/ tower\([_0-9]*\) / __tower\1__ /g
315 s/ u370 / __u370__ /g
316 s/ u3b\([0-9]*\) / __u3b\1__ /g
317 s/ unix / __unix__ /g
319 s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
320 s/ _*\([Rr][34]\)000 / __\1000__ /g
321 s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
323 s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
325 /^#define.NULL[ ]/ i\
327 ' $2/$file > $2/$file.
328 mv $2/$file.
$2/$file
329 if cmp $file $2/$file >/dev
/null
2>&1 \
330 ||
egrep 'This file is part of the GNU C Library' $2/$file >/dev
/null
2>&1; then
334 # Find any include directives that use "file".
335 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $2/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
336 dir
=`echo $file | sed -e s'|/[^/]*$||'`
337 required
="$required $1 $dir/$include $2/$dir/$include"
348 # Install the proper definition of the three standard types in header files
349 # that they come from.
350 for file in sys
/types.h stdlib.h sys
/stdtypes.h stddef.h memory.h unistd.h
; do
351 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
352 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
353 chmod +w
${LIB}/$file 2>/dev
/null
354 chmod a
+r
${LIB}/$file 2>/dev
/null
357 if [ -r ${LIB}/$file ]; then
358 echo Fixing size_t
, ptrdiff_t and wchar_t
in $file
360 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
361 #ifndef __SIZE_TYPE__\
362 #define __SIZE_TYPE__ long unsigned int\
365 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
366 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
367 #ifndef __PTRDIFF_TYPE__\
368 #define __PTRDIFF_TYPE__ long int\
371 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
372 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
373 #ifndef __WCHAR_TYPE__\
374 #define __WCHAR_TYPE__ int\
378 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\
381 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
382 ${LIB}/$file > ${LIB}/${file}.
sed
383 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
384 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
387 # Find any include directives that use "file".
388 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
389 dir
=`echo $file | sed -e s'|/[^/]*$||'`
390 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
396 # Fix one other error in this file: a mismatched quote not inside a C comment.
397 file=sundev
/vuid_event.h
398 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
399 mkdir
${LIB}/sundev
2>/dev
/null
400 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
401 chmod +w
${LIB}/$file 2>/dev
/null
402 chmod a
+r
${LIB}/$file 2>/dev
/null
405 if [ -r ${LIB}/$file ]; then
406 echo Fixing
$file comment
407 sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.
sed
408 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
409 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
412 # Find any include directives that use "file".
413 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
414 dir
=`echo $file | sed -e s'|/[^/]*$||'`
415 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
420 # Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
421 file=sunwindow
/win_cursor.h
422 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
423 # mkdir ${LIB}/sunwindow 2>/dev/null
424 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
425 chmod +w
${LIB}/$file 2>/dev
/null
427 if [ -r ${LIB}/$file ]; then
429 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
430 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
431 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
434 # Find any include directives that use "file".
435 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
436 dir
=`echo $file | sed -e s'|/[^/]*$||'`
437 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
441 file=sunwindow
/win_lock.h
442 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
443 # mkdir ${LIB}/sunwindow 2>/dev/null
444 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
445 chmod +w
${LIB}/$file 2>/dev
/null
447 if [ -r ${LIB}/$file ]; then
449 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
450 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
451 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
454 # Find any include directives that use "file".
455 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
456 dir
=`echo $file | sed -e s'|/[^/]*$||'`
457 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
462 # Fix this Sun file to avoid interfering with stddef.h.
464 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
465 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
466 chmod +w
${LIB}/$file 2>/dev
/null
467 chmod a
+r
${LIB}/$file 2>/dev
/null
470 if [ -r ${LIB}/$file ]; then
472 sed -e '/[ ]size_t.*;/i\
479 -e '/[ ]ptrdiff_t.*;/i\
480 #ifndef _GCC_PTRDIFF_T\
481 #define _GCC_PTRDIFF_T
483 -e '/[ ]ptrdiff_t.*;/a\
486 -e '/[ ]wchar_t.*;/i\
487 #ifndef _GCC_WCHAR_T\
490 -e '/[ ]wchar_t.*;/a\
492 ' ${LIB}/$file > ${LIB}/${file}.
sed
493 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
494 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
497 # Find any include directives that use "file".
498 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
499 dir
=`echo $file | sed -e s'|/[^/]*$||'`
500 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
505 # Fix this ARM/RISCiX file to avoid interfering with the use of __wchar_t
508 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
509 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
510 chmod +w
${LIB}/$file 2>/dev
/null
511 chmod a
+r
${LIB}/$file 2>/dev
/null
514 if [ -r ${LIB}/$file ]; then
516 sed -e "s/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
517 -e "s/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
518 ${LIB}/$file > ${LIB}/${file}.
sed
519 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
520 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
523 # Find any include directives that use "file".
524 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
525 dir
=`echo $file | sed -e s'|/[^/]*$||'`
526 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
531 # Fix this ARM/RISCiX file where ___type is a Compiler hint that is specific to
532 # the Norcroft compiler.
534 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
535 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
536 chmod +w
${LIB}/$file 2>/dev
/null
537 chmod a
+r
${LIB}/$file 2>/dev
/null
540 if [ -r ${LIB}/$file ]; then
542 sed -e "s/___type p_type/p_type/" \
543 ${LIB}/$file > ${LIB}/${file}.
sed
544 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
545 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
548 # Find any include directives that use "file".
549 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
550 dir
=`echo $file | sed -e s'|/[^/]*$||'`
551 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
556 # Fix this file to avoid interfering with stddef.h, but don't mistakenly
557 # match ssize_t present in AIX for the ps/2, or typedefs which use (but do not
560 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
561 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
562 chmod +w
${LIB}/$file 2>/dev
/null
563 chmod a
+r
${LIB}/$file 2>/dev
/null
566 if [ -r ${LIB}/$file ]; then
568 sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
572 -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
574 ' ${LIB}/$file > ${LIB}/${file}.
sed
575 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
576 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
579 # Find any include directives that use "file".
580 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
581 dir
=`echo $file | sed -e s'|/[^/]*$||'`
582 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
587 # Fix HP's use of ../machine/inline.h to refer to
588 # /usr/include/machine/inline.h
590 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
591 cp $file ${LIB}/$file
593 if [ -r ${LIB}/$file ] ; then
595 sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
596 -e 's,"../machine/psl.h",<machine/psl.h>,' \
597 ${LIB}/$file > ${LIB}/${file}.
sed
598 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
599 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
602 # Find any include directives that use "file".
603 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
604 dir
=`echo $file | sed -e s'|/[^/]*$||'`
605 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
610 # Fix an error in this file: the #if says _cplusplus, not the double
611 # underscore __cplusplus that it should be
613 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
614 mkdir
${LIB}/rpcsvc
2>/dev
/null
615 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
616 chmod +w
${LIB}/$file 2>/dev
/null
617 chmod a
+r
${LIB}/$file 2>/dev
/null
620 if [ -r ${LIB}/$file ]; then
621 echo Fixing
$file, __cplusplus macro
622 sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.
sed
623 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
624 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
627 # Find any include directives that use "file".
628 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
629 dir
=`echo $file | sed -e s'|/[^/]*$||'`
630 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
635 # Fix an error in this file: a missing semi-colon at the end of the statsswtch
636 # structure definition.
638 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
639 mkdir
${LIB}/rpcsvc
2>/dev
/null
640 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
641 chmod +w
${LIB}/$file 2>/dev
/null
642 chmod a
+r
${LIB}/$file 2>/dev
/null
645 if [ -r ${LIB}/$file ]; then
646 echo Fixing
$file, definition of statsswtch
647 sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.
sed
648 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
649 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
652 # Find any include directives that use "file".
653 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
654 dir
=`echo $file | sed -e s'|/[^/]*$||'`
655 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
660 # Fix an error in this file: a missing semi-colon at the end of the nodeent
661 # structure definition.
662 file=netdnet
/dnetdb.h
663 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
664 mkdir
${LIB}/netdnet
2>/dev
/null
665 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
666 chmod +w
${LIB}/$file 2>/dev
/null
667 chmod a
+r
${LIB}/$file 2>/dev
/null
670 if [ -r ${LIB}/$file ]; then
671 echo Fixing
$file, definition of nodeent
672 sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.
sed
673 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
674 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
677 # Find any include directives that use "file".
678 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
679 dir
=`echo $file | sed -e s'|/[^/]*$||'`
680 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
685 # Check for bad #ifdef line (in Ultrix 4.1)
687 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
688 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
689 chmod +w
${LIB}/$file 2>/dev
/null
690 chmod a
+r
${LIB}/$file 2>/dev
/null
693 if [ -r ${LIB}/$file ]; then
694 echo Fixing
$file, bad \
#ifdef line
695 sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.
sed
696 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
697 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
700 # Find any include directives that use "file".
701 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
702 dir
=`echo $file | sed -e s'|/[^/]*$||'`
703 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
708 # Check for (...) in C++ code in HP/UX sys/file.h.
710 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
711 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
712 chmod +w
${LIB}/$file 2>/dev
/null
713 chmod a
+r
${LIB}/$file 2>/dev
/null
716 if [ -r ${LIB}/$file ]; then
717 if egrep HPUX_SOURCE
${LIB}/$file > /dev
/null
; then
718 echo Fixing
$file, use of
'(...)'
719 sed -e 's/(\.\.\.)/(struct file * ...)/' ${LIB}/$file > ${LIB}/${file}.
sed
720 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
721 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
724 # Find any include directives that use "file".
725 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
726 dir
=`echo $file | sed -e s'|/[^/]*$||'`
727 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
733 # Check for superfluous `static' (in Ultrix 4.2)
734 # On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
736 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
737 mkdir
${LIB}/machine
2>/dev
/null
738 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
739 chmod +w
${LIB}/$file 2>/dev
/null
740 chmod a
+r
${LIB}/$file 2>/dev
/null
743 if [ -r ${LIB}/$file ]; then
744 echo Fixing
$file, superfluous static and broken includes of other files.
745 sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
746 -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
747 -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
748 ${LIB}/$file > ${LIB}/${file}.
sed
749 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
750 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
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"
758 # This file has an alternative name, mips/cpu.h. Fix that name, too.
759 if cmp machine
/cpu.h mips
/cpu.h
> /dev
/null
2>&1; then
760 mkdir
${LIB}/mips
2>&-
761 # Don't remove the file first, they may be the same file!
762 ln ${LIB}/$file ${LIB}/mips
/cpu.h
> /dev
/null
2>&1
767 # Incorrect sprintf declaration in X11/Xmu.h
769 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
770 mkdir
${LIB}/X11
2>/dev
/null
771 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
772 chmod +w
${LIB}/$file 2>/dev
/null
773 chmod a
+r
${LIB}/$file 2>/dev
/null
776 if [ -r ${LIB}/$file ]; then
777 echo Fixing
$file sprintf declaration
778 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
779 extern char * sprintf();\
780 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
781 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
782 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
785 # Find any include directives that use "file".
786 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
787 dir
=`echo $file | sed -e s'|/[^/]*$||'`
788 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
793 # Incorrect sprintf declaration in X11/Xmu/Xmu.h
794 # (It's not clear whether the right file name is this or X11/Xmu.h.)
796 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
797 mkdir
${LIB}/X11
/Xmu
2>/dev
/null
798 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
799 chmod +w
${LIB}/$file 2>/dev
/null
800 chmod a
+r
${LIB}/$file 2>/dev
/null
803 if [ -r ${LIB}/$file ]; then
804 echo Fixing
$file sprintf declaration
805 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
806 extern char * sprintf();\
807 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
808 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
809 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
812 # Find any include directives that use "file".
813 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
814 dir
=`echo $file | sed -e s'|/[^/]*$||'`
815 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
820 # Check for missing ';' in struct
822 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
823 mkdir
${LIB}/netinet
2>/dev
/null
824 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
825 chmod +w
${LIB}/$file 2>/dev
/null
826 chmod a
+r
${LIB}/$file 2>/dev
/null
829 if [ -r ${LIB}/$file ]; then
831 sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.
sed
832 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
833 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
836 # Find any include directives that use "file".
837 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
838 dir
=`echo $file | sed -e s'|/[^/]*$||'`
839 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
844 # Fix the CAT macro in SunOS memvar.h.
845 file=pixrect
/memvar.h
846 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
847 mkdir
${LIB}/pixrect
2>/dev
/null
848 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
849 chmod +w
${LIB}/$file 2>/dev
/null
850 chmod a
+r
${LIB}/$file 2>/dev
/null
853 if [ -r ${LIB}/$file ]; then
855 sed -e '/^#define.CAT(a,b)/ i\
857 #define CAT(a,b) a##b\
859 /^#define.CAT(a,b)/ a\
861 ' ${LIB}/$file > ${LIB}/${file}.
sed
862 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
863 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
866 # Find any include directives that use "file".
867 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
868 dir
=`echo $file | sed -e s'|/[^/]*$||'`
869 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
874 # Check for yet more missing ';' in struct (in SunOS 4.0.x)
876 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
877 mkdir
${LIB}/rpcsvc
2>/dev
/null
878 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
879 chmod +w
${LIB}/$file 2>/dev
/null
880 chmod a
+r
${LIB}/$file 2>/dev
/null
883 if [ -r ${LIB}/$file ]; then
885 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.
sed
886 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
887 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
890 # Find any include directives that use "file".
891 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
892 dir
=`echo $file | sed -e s'|/[^/]*$||'`
893 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
898 # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
899 # Also wrap protection around size_t for m88k-sysv3 systems.
901 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
902 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
903 chmod +w
${LIB}/$file 2>/dev
/null
904 chmod a
+r
${LIB}/$file 2>/dev
/null
907 if [ -r ${LIB}/$file ]; then
909 sed -e 's/int abort/void abort/g' \
910 -e 's/int free/void free/g' \
911 -e 's/char[ ]*\*[ ]*calloc/void \* calloc/g' \
912 -e 's/char[ ]*\*[ ]*malloc/void \* malloc/g' \
913 -e 's/char[ ]*\*[ ]*realloc/void \* realloc/g' \
914 -e 's/int[ ][ ]*exit/void exit/g' \
915 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
919 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
922 ${LIB}/$file > ${LIB}/${file}.
sed
923 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
924 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
927 # Find any include directives that use "file".
928 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
929 dir
=`echo $file | sed -e s'|/[^/]*$||'`
930 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
935 # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
936 # Also fix return type of {m,re}alloc in <malloc.h> on sysV68
938 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
939 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
940 chmod +w
${LIB}/$file 2>/dev
/null
941 chmod a
+r
${LIB}/$file 2>/dev
/null
944 if [ -r ${LIB}/$file ]; then
946 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
947 -e 's/int[ ][ ]*free/void free/g' \
948 -e 's/char\([ ]*\*[ ]*malloc\)/void\1/g' \
949 -e 's/char\([ ]*\*[ ]*realloc\)/void\1/g' \
950 ${LIB}/$file > ${LIB}/${file}.
sed
951 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
952 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
955 # Find any include directives that use "file".
956 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
957 dir
=`echo $file | sed -e s'|/[^/]*$||'`
958 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
963 # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
964 file=hsfs
/hsfs_spec.h
965 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
966 mkdir
${LIB}/hsfs
2>/dev
/null
967 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
968 chmod +w
${LIB}/$file 2>/dev
/null
969 chmod a
+r
${LIB}/$file 2>/dev
/null
972 if [ -r ${LIB}/$file ]; then
974 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
975 ${LIB}/$file > ${LIB}/${file}.
976 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
977 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
980 # Find any include directives that use "file".
981 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
982 dir
=`echo $file | sed -e s'|/[^/]*$||'`
983 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
988 # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
990 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
991 mkdir
${LIB}/hsfs
2>/dev
/null
992 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
993 chmod +w
${LIB}/$file 2>/dev
/null
994 chmod a
+r
${LIB}/$file 2>/dev
/null
997 if [ -r ${LIB}/$file ]; then
999 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
1000 ${LIB}/$file > ${LIB}/${file}.
sed
1001 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1002 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1005 # Find any include directives that use "file".
1006 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1007 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1008 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1013 # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
1014 file=hsfs
/iso_spec.h
1015 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1016 mkdir
${LIB}/hsfs
2>/dev
/null
1017 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1018 chmod +w
${LIB}/$file 2>/dev
/null
1019 chmod a
+r
${LIB}/$file 2>/dev
/null
1022 if [ -r ${LIB}/$file ]; then
1024 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
1025 ${LIB}/$file > ${LIB}/${file}.
sed
1026 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1027 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1030 # Find any include directives that use "file".
1031 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1032 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1033 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1038 # Incorrect #include in Sony News-OS 3.2.
1039 file=machine
/machparam.h
1040 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1041 mkdir
${LIB}/machine
2>/dev
/null
1042 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1043 chmod +w
${LIB}/$file 2>/dev
/null
1044 chmod a
+r
${LIB}/$file 2>/dev
/null
1047 if [ -r ${LIB}/$file ]; then
1048 echo Fixing
$file, incorrect \
#include
1049 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
1050 ${LIB}/$file > ${LIB}/${file}.
1051 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
1052 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1055 # Find any include directives that use "file".
1056 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1057 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1058 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1063 # Multiline comment after typedef on IRIX 4.0.1.
1065 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1066 mkdir
${LIB}/sys
2>/dev
/null
1067 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1068 chmod +w
${LIB}/$file 2>/dev
/null
1069 chmod a
+r
${LIB}/$file 2>/dev
/null
1072 if [ -r ${LIB}/$file ]; then
1073 echo Fixing
$file, comment
in the middle of \
#ifdef
1074 sed -e 's@type of the result@type of the result */@' \
1075 -e 's@of the sizeof@/* of the sizeof@' \
1076 ${LIB}/$file > ${LIB}/${file}.
sed
1077 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1078 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1081 # Find any include directives that use "file".
1082 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1083 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1084 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1089 # Turning // comments into /* */ comments trashes this IRIX 4.0.1
1090 # header file, which embeds // comments inside multi-line /* */
1091 # comments. If this looks like the IRIX header file, we refix it by
1092 # just throwing away the // comments.
1094 if [ -r ${LIB}/$file ]; then
1095 if egrep indigo.esd
${LIB}/$file > /dev
/null
; then
1096 echo Fixing
$file, overeager
sed script
1098 sed -e 's|//.*$||g' $file > ${LIB}/$file
1099 chmod +w
${LIB}/$file 2>/dev
/null
1100 chmod a
+r
${LIB}/$file 2>/dev
/null
1104 # There is a similar problem with the VxWorks drv/netif/if_med.h file.
1105 file=drv
/netif
/if_med.h
1106 if [ -r ${LIB}/$file ]; then
1107 if egrep 'Wind River' ${LIB}/$file > /dev
/null
; then
1108 echo Fixing
$file, overeager
sed script
1110 sed -e 's|//.*$||g' $file > ${LIB}/$file
1111 chmod +w
${LIB}/$file 2>/dev
/null
1112 chmod a
+r
${LIB}/$file 2>/dev
/null
1116 # Some IRIX header files contains the string "//"
1117 for file in elf_abi.h elf.h
; do
1118 if [ -r ${LIB}/$file ]; then
1119 echo Fixing
$file, overeager
sed script
1120 sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.
sed
1121 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1122 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1125 # Find any include directives that use "file".
1126 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1127 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1128 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1134 # IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr in prototype without
1135 # previous definition.
1137 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1138 mkdir
${LIB}/rpc
2>/dev
/null
1139 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1140 chmod +w
${LIB}/$file 2>/dev
/null
1141 chmod a
+r
${LIB}/$file 2>/dev
/null
1144 if [ -r ${LIB}/$file ]; then
1145 echo Fixing
$file, undefined
type
1146 sed -e '/authdes_create.*struct sockaddr/i\
1149 ${LIB}/$file > ${LIB}/$file.
sed
1150 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1151 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1154 # Find any include directives that use "file".
1155 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1156 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1157 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1162 # IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s in prototype without previous
1165 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1166 mkdir
${LIB}/rpc
2>/dev
/null
1167 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1168 chmod +w
${LIB}/$file 2>/dev
/null
1169 chmod a
+r
${LIB}/$file 2>/dev
/null
1172 if [ -r ${LIB}/$file ]; then
1173 echo Fixing
$file, undefined
type
1174 sed -e '/xdrstdio_create.*struct __file_s/i\
1177 ${LIB}/$file > ${LIB}/$file.
sed
1178 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1179 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1182 # Find any include directives that use "file".
1183 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1184 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1185 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1190 # Same problem with a file from SunOS 4.1.3 : a header file containing
1191 # the string "//" embedded in "/**/"
1192 file=sbusdev
/audiovar.h
1193 if [ -r ${LIB}/$file ]; then
1194 echo Fixing
$file, overeager
sed script
1196 sed -e 's|//.*$||g' $file > ${LIB}/$file
1197 chmod +w
${LIB}/$file 2>/dev
/null
1198 chmod a
+r
${LIB}/$file 2>/dev
/null
1201 # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
1202 # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
1203 # many other systems have similar text but correct versions of the file.
1204 # To ensure only Sun's is fixed, we grep for a likely unique string.
1205 # Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
1207 if [ -r $file ] && egrep '/\* @\(#\)(head/memory.h 50.1 |memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 )\*/' $file > /dev
/null
; then
1208 if [ ! -r ${LIB}/$file ]; then
1209 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1210 chmod +w
${LIB}/$file 2>/dev
/null
1211 chmod a
+r
${LIB}/$file 2>/dev
/null
1213 if [ -r ${LIB}/$file ]; then
1214 echo Replacing
$file
1215 cat > ${LIB}/$file << EOF
1216 /* This file was generated by fixincludes */
1217 #ifndef __memory_h__
1218 #define __memory_h__
1221 extern void *memccpy();
1222 extern void *memchr();
1223 extern void *memcpy();
1224 extern void *memset();
1226 extern char *memccpy();
1227 extern char *memchr();
1228 extern char *memcpy();
1229 extern char *memset();
1230 #endif /* __STDC__ */
1232 extern int memcmp();
1234 #endif /* __memory_h__ */
1239 # Fix return type of fread and fwrite on sysV68
1241 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1242 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1243 chmod +w
${LIB}/$file 2>/dev
/null
1244 chmod a
+r
${LIB}/$file 2>/dev
/null
1247 if [ -r ${LIB}/$file ]; then
1248 echo Fixing
$file, fread and fwrite
return type
1249 sed -e 's/^\(extern int fclose(), fflush()\), \(fread(), fwrite()\)\(.*\)$/extern unsigned int \2;\
1251 ${LIB}/$file > ${LIB}/${file}.
sed
1252 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1253 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1256 # Find any include directives that use "file".
1257 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1258 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1259 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1264 # parameters not const on DECstation Ultrix V4.0 and OSF/1.
1266 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1267 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1268 chmod +w
${LIB}/$file 2>/dev
/null
1269 chmod a
+r
${LIB}/$file 2>/dev
/null
1272 if [ -r ${LIB}/$file ]; then
1273 echo Fixing
$file, non-const arg
1274 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
1275 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
1276 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
1277 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
1278 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
1279 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
1280 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
1281 -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
1282 -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
1283 ${LIB}/$file > ${LIB}/${file}.
sed
1284 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1285 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1288 # Find any include directives that use "file".
1289 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1290 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1291 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1296 # parameters conflict with C++ new on rs/6000
1297 for file in stdio.h unistd.h
; do
1298 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1299 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1300 chmod +w
${LIB}/$file 2>/dev
/null
1303 if [ -r ${LIB}/$file ]; then
1304 echo Fixing
$file, parameter name conflicts
1305 sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
1306 ${LIB}/$file > ${LIB}/${file}.
sed
1307 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1308 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1311 # Find any include directives that use "file".
1312 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1313 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1314 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1320 # function class(double x) conflicts with C++ keyword on rs/6000
1322 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1323 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1324 chmod +w
${LIB}/$file 2>/dev
/null
1325 chmod a
+r
${LIB}/$file 2>/dev
/null
1328 if [ -r ${LIB}/$file ]; then
1329 if grep '[^a-zA-Z_]class[(]' ${LIB}/$file >/dev
/null
; then
1331 sed -e '/class[(]/i\
1336 ' ${LIB}/$file > ${LIB}/${file}.
sed
1337 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1338 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1341 # Find any include directives that use "file".
1342 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1343 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1344 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1350 # Wrong fchmod prototype on RS/6000.
1352 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1353 mkdir
${LIB}/sys
2>/dev
/null
1354 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1355 chmod +w
${LIB}/$file 2>/dev
/null
1356 chmod a
+r
${LIB}/$file 2>/dev
/null
1359 if [ -r ${LIB}/$file ]; then
1360 echo Fixing
$file, fchmod prototype
1361 sed -e 's/fchmod(char \*/fchmod(int/' \
1362 ${LIB}/$file > ${LIB}/$file.
sed
1363 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1364 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1367 # Find any include directives that use "file".
1368 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1369 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1370 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1375 # There are several name conflicts with C++ reserved words in X11
1376 # header files. These are fixed in some versions, so don't do the
1377 # fixes if we find __cplusplus in the file. These were found on the
1380 # class in X11/ShellP.h
1382 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1383 mkdir
${LIB}/sys
2>/dev
/null
1384 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1385 chmod +w
${LIB}/$file 2>/dev
/null
1386 chmod a
+r
${LIB}/$file 2>/dev
/null
1389 if [ -r ${LIB}/$file ]; then
1390 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1393 echo Fixing
$file, field class
1394 sed -e '/char [*]class;/i\
1399 -e '/char [*]class;/a\
1401 ' ${LIB}/$file > ${LIB}/${file}.
sed
1402 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1404 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1407 # Find any include directives that use "file".
1408 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1409 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1410 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1414 # new in Xm/Traversal.h
1416 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1417 mkdir
${LIB}/sys
2>/dev
/null
1418 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1419 chmod +w
${LIB}/$file 2>/dev
/null
1420 chmod a
+r
${LIB}/$file 2>/dev
/null
1423 if [ -r ${LIB}/$file ]; then
1424 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1427 echo Fixing
$file, uses of new
1428 sed -e '/Widget old, new;/i\
1433 -e '/Widget old, new;/a\
1436 -e 's/Widget new,/Widget c_new,/g' ${LIB}/$file > ${LIB}/${file}.
sed
1437 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1439 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1442 # Find any include directives that use "file".
1443 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1444 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1445 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1449 # class in Xm/BaseClassI.h
1450 file=Xm
/BaseClassI.h
1451 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1452 mkdir
${LIB}/sys
2>/dev
/null
1453 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1454 chmod +w
${LIB}/$file 2>/dev
/null
1455 chmod a
+r
${LIB}/$file 2>/dev
/null
1458 if [ -r ${LIB}/$file ]; then
1459 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1462 echo Fixing
$file, prototype parameter name
1463 sed -e 's/ class[)]/ c_class)/g' ${LIB}/$file > ${LIB}/${file}.
sed
1464 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1466 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
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"
1477 # NeXT 3.2 adds const prefix to some math functions. These conflict
1478 # with the built-in functions.
1480 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1481 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1482 chmod +w
${LIB}/$file 2>/dev
/null
1484 if [ -r ${LIB}/$file ]; then
1486 sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \
1487 -e '/^extern.*double.*__const__.*fabs(/s/__const__//' \
1488 -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
1489 -e '/^extern.*double.*__const__.*sin(/s/__const__//' ${LIB}/$file > ${LIB}/${file}.
sed
1490 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1491 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1494 # Find any include directives that use "file".
1495 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1496 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1497 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1502 # NeXT 3.2 uses the word "template" as a parameter for some
1503 # functions. GCC reports an invalid use of a reserved key word
1504 # with the built-in functions. NeXT 3.2 includes the keyword
1505 # volatile in the prototype for abort(). This conflicts with
1506 # the built-in definition.
1508 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1509 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1510 chmod +w
${LIB}/$file 2>/dev
/null
1512 if [ -r ${LIB}/$file ]; then
1514 sed -e '/\(.*template\)/s/template//' \
1515 -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.
sed
1516 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1517 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1520 # Find any include directives that use "file".
1521 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1522 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1523 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1528 # NeXT 3.2 includes the keyword volatile in the abort() and
1529 # exit() function prototypes. That conflicts with the
1530 # built-in functions.
1532 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1533 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1534 chmod +w
${LIB}/$file 2>/dev
/null
1536 if [ -r ${LIB}/$file ]; then
1538 sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
1539 -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.
sed
1540 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1541 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1544 # Find any include directives that use "file".
1545 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1546 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1547 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1552 # sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
1553 # of struct rusage, so the prototype (added by fixproto) causes havoc.
1555 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1556 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1557 chmod +w
${LIB}/$file 2>/dev
/null
1560 if [ -r ${LIB}/$file ] \
1561 && grep 'bos325,' ${LIB}/$file >/dev
/null
; then
1562 echo Fixing
$file, wait3 declaration
1563 sed -e '/^extern pid_t wait3();$/i\
1566 ${LIB}/$file > ${LIB}/${file}.
sed
1567 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1568 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1571 # Find any include directives that use "file".
1572 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1573 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1574 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1579 # NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1580 # Note that version 3 of the NeXT system has wait.h in a different directory,
1581 # so that this code won't do anything. But wait.h in version 3 has a
1582 # conditional, so it doesn't need this fix. So everything is okay.
1584 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1585 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1586 chmod +w
${LIB}/$file 2>/dev
/null
1589 if [ -r ${LIB}/$file ] \
1590 && grep 'wait[(]union wait' ${LIB}/$file >/dev
/null
; then
1591 echo Fixing
$file, bad
wait formal
1592 sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.
sed
1593 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1594 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1597 # Find any include directives that use "file".
1598 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1599 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1600 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1605 # Don't use or define the name va_list in stdio.h.
1606 # This is for ANSI and also to interoperate properly with gcc's varargs.h.
1608 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1609 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1610 chmod +w
${LIB}/$file 2>/dev
/null
1611 chmod a
+r
${LIB}/$file 2>/dev
/null
1614 if [ -r ${LIB}/$file ]; then
1615 echo Fixing
$file, use of va_list
1616 # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1617 if egrep "__need___va_list" ${LIB}/$file >/dev
/null
2>&1; then
1618 touch ${LIB}/${file}.
sed
1620 (echo "#define __need___va_list"
1621 echo "#include <stdarg.h>") > ${LIB}/${file}.
sed
1623 # Use __gnuc_va_list in arg types in place of va_list.
1624 # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1625 # trailing parentheses and semicolon save all other systems from this.
1626 # Define __va_list__ (something harmless and unused) instead of va_list.
1627 # Don't claim to have defined va_list.
1628 sed -e 's@ va_list @ __gnuc_va_list @' \
1629 -e 's@ va_list)@ __gnuc_va_list)@' \
1630 -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
1631 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
1632 -e 's@ va_list@ __va_list__@' \
1633 -e 's@\*va_list@*__va_list__@' \
1634 -e 's@ __va_list)@ __gnuc_va_list)@' \
1635 -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
1636 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
1637 -e 's@VA_LIST@DUMMY_VA_LIST@' \
1638 -e 's@_Va_LIST@_VA_LIST@' \
1639 ${LIB}/$file >> ${LIB}/${file}.
sed
1641 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1642 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1645 # Find any include directives that use "file".
1646 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1647 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1648 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1653 # Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
1655 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1656 if grep -s ULTRIX
$file; then
1657 echo "/* This file intentionally left blank. */" > $LIB/$file
1661 # parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
1662 # also get rid of bogus inline definitions in HP-UX 8.0
1664 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1665 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1666 chmod +w
${LIB}/$file 2>/dev
/null
1667 chmod a
+r
${LIB}/$file 2>/dev
/null
1670 if [ -r ${LIB}/$file ]; then
1671 echo Fixing
$file, non-const arg
1672 sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \
1673 -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
1674 -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
1675 -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
1676 -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
1677 ${LIB}/$file > ${LIB}/${file}.
sed
1678 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1679 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1682 # Find any include directives that use "file".
1683 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1684 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1685 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1690 # fix bogus recursive stdlib.h in NEWS-OS 4.0C
1692 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1693 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1694 chmod +w
${LIB}/$file 2>/dev
/null
1695 chmod a
+r
${LIB}/$file 2>/dev
/null
1698 if [ -r ${LIB}/$file ]; then
1699 echo Fixing
$file, recursive inclusion
1700 sed -e '/^#include <stdlib.h>/i\
1703 -e '/^#include <stdlib.h>/a\
1706 ${LIB}/$file > ${LIB}/${file}.
sed
1707 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1708 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1711 # Find any include directives that use "file".
1712 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1713 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1714 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1719 # Avoid nested comments on Ultrix 4.3.
1721 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1722 mkdir
${LIB}/rpc
2>/dev
/null
1723 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1724 chmod +w
${LIB}/$file 2>/dev
/null
1725 chmod a
+r
${LIB}/$file 2>/dev
/null
1728 if [ -r ${LIB}/$file ]; then
1729 echo Fixing
$file, nested comment
1730 sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
1731 ${LIB}/$file > ${LIB}/$file.
sed
1732 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1733 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1736 # Find any include directives that use "file".
1737 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1738 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1739 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1744 # This file in RISC/os uses /**/ to concatenate two tokens.
1746 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1747 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1748 chmod +w
${LIB}/$file 2>/dev
/null
1749 chmod a
+r
${LIB}/$file 2>/dev
/null
1751 if [ -r ${LIB}/$file ]; then
1752 sed -e 's|/\*\*/|##|' ${LIB}/$file > ${LIB}/${file}.
sed
1753 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1754 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1757 # Find any include directives that use "file".
1758 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1759 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1760 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1766 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1767 mkdir
${LIB}/rpc
2>/dev
/null
1768 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1769 chmod +w
${LIB}/$file 2>/dev
/null
1770 chmod a
+r
${LIB}/$file 2>/dev
/null
1773 if [ -r ${LIB}/$file ]; then
1774 echo Fixing
$file, nested comment
1775 sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
1776 ${LIB}/$file > ${LIB}/$file.
sed
1777 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1778 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1781 # Find any include directives that use "file".
1782 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1783 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1784 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1789 # rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
1790 # is defined for the alpha. The problem is the declaration of malloc.
1792 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1793 mkdir
${LIB}/rpc
2>/dev
/null
1794 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1795 chmod +w
${LIB}/$file 2>/dev
/null
1796 chmod a
+r
${LIB}/$file 2>/dev
/null
1798 if [ -r ${LIB}/$file ]; then
1799 if egrep '"C"' ${LIB}/$file >/dev
/null
2>&1; then
1803 echo '#ifdef __cplusplus
1805 #endif' > ${LIB}/${file}.
sed
1806 cat ${LIB}/${file} >> ${LIB}/${file}.
sed
1807 echo '#ifdef __cplusplus
1809 #endif' >> ${LIB}/${file}.
sed
1810 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1811 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1814 # Find any include directives that use "file".
1815 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1816 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1817 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1823 # In limits.h, put #ifndefs around things that are supposed to be defined
1824 # in float.h to avoid redefinition errors if float.h is included first.
1825 # On HP/UX this patch does not work, because on HP/UX limits.h uses
1826 # multi line comments and the inserted #endif winds up inside the
1827 # comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1828 # we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1829 # are there, and we do not add them ourselves.
1830 for file in limits.h sys
/limits.h
; do
1831 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1832 mkdir
${LIB}/sys
2>/dev
/null
1833 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1834 chmod +w
${LIB}/$file 2>/dev
/null
1835 chmod a
+r
${LIB}/$file 2>/dev
/null
1838 if [ -r ${LIB}/$file ]; then
1839 if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev
/null
; then
1843 sed -e '/[ ]FLT_MIN[ ]/i\
1846 -e '/[ ]FLT_MIN[ ]/a\
1849 -e '/[ ]FLT_MAX[ ]/i\
1852 -e '/[ ]FLT_MAX[ ]/a\
1855 -e '/[ ]FLT_DIG[ ]/i\
1858 -e '/[ ]FLT_DIG[ ]/a\
1861 -e '/[ ]DBL_MIN[ ]/i\
1864 -e '/[ ]DBL_MIN[ ]/a\
1867 -e '/[ ]DBL_MAX[ ]/i\
1870 -e '/[ ]DBL_MAX[ ]/a\
1873 -e '/[ ]DBL_DIG[ ]/i\
1876 -e '/[ ]DBL_DIG[ ]/a\
1879 ${LIB}/$file > ${LIB}/${file}.
sed
1880 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1882 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1883 echo Deleting
${LIB}/$file\
; no fixes were needed.
1886 # Find any include directives that use "file".
1887 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1888 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1889 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1895 # In math.h, put #ifndefs around things that might be defined in a gcc
1896 # specific math-*.h file.
1898 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1899 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1900 chmod +w
${LIB}/$file 2>/dev
/null
1901 chmod a
+r
${LIB}/$file 2>/dev
/null
1904 if [ -r ${LIB}/$file ]; then
1906 sed -e '/define[ ]HUGE_VAL[ ]/i\
1909 -e '/define[ ]HUGE_VAL[ ]/a\
1912 ${LIB}/$file > ${LIB}/${file}.
sed
1913 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1915 # In addition, copy the definition of DBL_MAX from float.h
1916 # if math.h requires one. The Lynx math.h requires it.
1917 if egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file >/dev
/null
2>&1; then
1918 if egrep '#define[ ]+DBL_MAX[ ]+' $file >/dev
/null
2>&1; then
1921 dbl_max_def
=`egrep 'define[ ]+DBL_MAX[ ]+.*' float.h 2>/dev/null`
1922 if [ "$dbl_max_def" != "" ]; then
1923 dbl_max_def
=`echo $dbl_max_def | sed 's/.*define[ ]*DBL_MAX[ ]*//'`
1924 sed -e "/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/" \
1925 ${LIB}/$file > ${LIB}/${file}.
sed
1926 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1931 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1932 echo Deleting
${LIB}/$file\
; no fixes were needed.
1935 # Find any include directives that use "file".
1936 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1937 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1938 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1943 # Remove erroneous parentheses in sym.h on Alpha OSF/1.
1945 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1946 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1947 chmod +w
${LIB}/$file 2>/dev
/null
1948 chmod a
+r
${LIB}/$file 2>/dev
/null
1951 if [ -r ${LIB}/$file ]; then
1953 sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
1954 ${LIB}/$file > ${LIB}/${file}.
sed
1955 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1956 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1959 # Find any include directives that use "file".
1960 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1961 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1962 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1967 # Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
1968 # in string.h on sysV68
1969 # Correct the return type for strlen in string.h on Lynx.
1970 # Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
1971 # Add missing const for strdup on OSF/1 V3.0.
1973 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1974 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1975 chmod +w
${LIB}/$file 2>/dev
/null
1976 chmod a
+r
${LIB}/$file 2>/dev
/null
1979 if [ -r ${LIB}/$file ]; then
1980 echo Fixing
$file, mem
{ccpy
,chr
,cpy
,set} and str
{len
,spn
,cspn
} return value
1981 sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \
1982 -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \
1983 -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
1984 -e '/^extern char$/N' \
1985 -e 's/^extern char\(\n \*memccpy(),\)$/extern void\1/'\
1986 -e '/^ strncmp(),$/N'\
1987 -e 's/^\( strncmp()\),\n\( strlen(),\)$/\1;\
1988 extern unsigned int\
1990 ${LIB}/$file > ${LIB}/${file}.
sed
1991 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1992 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1995 # Find any include directives that use "file".
1996 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1997 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1998 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2003 # Correct the return type for strlen in strings.h in SunOS 4.
2005 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2006 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2007 chmod +w
${LIB}/$file 2>/dev
/null
2008 chmod a
+r
${LIB}/$file 2>/dev
/null
2011 if [ -r ${LIB}/$file ]; then
2013 sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \
2014 ${LIB}/$file > ${LIB}/${file}.
sed
2015 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2016 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2019 # Find any include directives that use "file".
2020 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2021 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2022 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2027 # Delete the '#define void int' line from curses.h on Lynx
2029 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2030 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2031 chmod +w
${LIB}/$file 2>/dev
/null
2032 chmod a
+r
${LIB}/$file 2>/dev
/null
2035 if [ -r ${LIB}/$file ]; then
2037 sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \
2038 ${LIB}/$file > ${LIB}/${file}.
sed
2039 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2040 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2043 # Find any include directives that use "file".
2044 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2045 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2046 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2051 # Fix `typedef struct term;' on hppa1.1-hp-hpux9.
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
2059 if [ -r ${LIB}/$file ]; then
2061 sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \
2062 ${LIB}/$file > ${LIB}/${file}.
sed
2063 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2064 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2067 # Find any include directives that use "file".
2068 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2069 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2070 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2075 # For C++, avoid any typedef or macro definition of bool, and use the
2076 # built in type instead.
2077 for files
in curses.h
; do
2078 if [ -r $file ] && egrep bool
$file >/dev
/null
2>&1; then
2079 if [ ! -r ${LIB}/$file ]; then
2080 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2081 chmod +w
${LIB}/$file 2>/dev
/null
2082 chmod a
+r
${LIB}/$file 2>/dev
/null
2086 sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
2089 -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
2092 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\
2095 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\
2098 ${LIB}/$file > ${LIB}/${file}.
sed
2099 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2100 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2103 # Find any include directives that use "file".
2104 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2105 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2106 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2112 # Fix incorrect S_IF* definitions on m88k-sysv3.
2114 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2115 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2116 chmod +w
${LIB}/$file 2>/dev
/null
2117 chmod a
+r
${LIB}/$file 2>/dev
/null
2120 if [ -r ${LIB}/$file ]; then
2122 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)/' \
2123 -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
2124 ${LIB}/$file > ${LIB}/${file}.
sed
2125 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2126 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2129 # Find any include directives that use "file".
2130 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2131 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2132 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2137 # Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
2138 for file in stdio.h stdlib.h
; do
2139 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2140 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2141 chmod +w
${LIB}/$file 2>/dev
/null
2142 chmod a
+r
${LIB}/$file 2>/dev
/null
2145 if [ -r ${LIB}/$file ]; then
2146 echo Fixing
$file, getopt declaration
2147 sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
2148 ${LIB}/$file > ${LIB}/${file}.
sed
2149 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2150 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2153 # Find any include directives that use "file".
2154 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2155 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2156 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2162 # Fix __page_size* declarations in pthread.h AIX 4.1.[34].
2163 # The original ones fail if uninitialized externs are not common.
2164 # This is the default for all ANSI standard C++ compilers.
2165 for file in pthread.h
; do
2166 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2167 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2168 chmod +w
${LIB}/$file 2>/dev
/null
2169 chmod a
+r
${LIB}/$file 2>/dev
/null
2172 if [ -r ${LIB}/$file ]; then
2173 echo Fixing
$file, __page_size
* declarations
2174 sed -e 's/^int __page_size/extern int __page_size/' \
2175 ${LIB}/$file > ${LIB}/${file}.
sed
2176 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2177 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2180 # Find any include directives that use "file".
2181 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2182 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2183 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2189 # Determine if we're on Interactive Unix 2.2 or later, in which case we
2190 # need to fix some additional files. This is the same test for ISC that
2192 if test -d /etc
/conf
/kconfig.d \
2193 && grep _POSIX_VERSION
/usr
/include
/sys
/unistd.h
>/dev
/null
2>&1; then
2194 echo "Fixing ISC __STDC__ goof in several files..."
2195 for name
in stdio.h math.h ctype.h sys
/limits.h sys
/fcntl.h sys
/dirent.h
; do
2197 if test -r ${LIB}/$name; then
2202 # On Interactive 2.2, certain traditional Unix definitions
2203 # (notably getc and putc in stdio.h) are omitted if __STDC__ is
2204 # defined, not just if _POSIX_SOURCE is defined. This makes it
2205 # impossible to compile any nontrivial program except with -posix.
2207 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
2208 < $file > ${LIB}/$name.
2209 mv ${LIB}/$name.
${LIB}/$name
2212 echo "Fixing ISC fmod declaration"
2213 # This one's already been fixed for other things.
2215 sed 's/fmod(double)/fmod(double, double)/' <$file >$file.
2218 echo "Fixing nested comments in ISC <sys/limits.h>"
2220 sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file.
2221 sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file.
>${LIB}/$file
2224 # These files in Sun OS 4.x use /**/ to concatenate tokens.
2225 for file in sparc
/asm_linkage.h sun
3/asm_linkage.h sun3x
/asm_linkage.h \
2226 sun
4/asm_linkage.h sun4c
/asm_linkage.h sun4m
/asm_linkage.h \
2227 sun4c
/debug
/asm_linkage.h sun4m
/debug
/asm_linkage.h
;
2229 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2230 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2231 chmod +w
${LIB}/$file 2>/dev
/null
2232 chmod a
+r
${LIB}/$file 2>/dev
/null
2235 if [ -r ${LIB}/$file ]; then
2236 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
2237 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2238 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2241 # Find any include directives that use "file".
2242 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2243 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2244 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2250 # These files in ARM/RISCiX use /**/ to concatenate tokens.
2251 for file in arm
/as_support.h
arm
/mc_type.h
arm
/xcb.h dev
/chardefmac.h \
2252 dev
/ps_irq.h dev
/screen.h dev
/scsi.h sys
/tty.h Xm.acorn
/XmP.h
2254 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2255 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2256 chmod +w
${LIB}/$file 2>/dev
/null
2257 chmod a
+r
${LIB}/$file 2>/dev
/null
2260 if [ -r ${LIB}/$file ]; then
2261 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
2262 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2263 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2266 # Find any include directives that use "file".
2267 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2268 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2269 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2275 # math.h on SunOS 4 puts the declaration of matherr before the definition
2276 # of struct exception, so the prototype (added by fixproto) causes havoc.
2278 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2279 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2280 chmod +w
${LIB}/$file 2>/dev
/null
2281 chmod a
+r
${LIB}/$file 2>/dev
/null
2284 if [ -r ${LIB}/$file ]; then
2285 echo Fixing
$file, matherr declaration
2286 sed -e '/^struct exception/,$b' \
2290 ${LIB}/$file > ${LIB}/${file}.
sed
2291 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2292 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2295 # Find any include directives that use "file".
2296 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2297 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2298 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2303 # assert.h and sys/mman.h on HP/UX are not C++ ready, even though
2304 # NO_IMPLICIT_EXTERN_C is defined on HP/UX.
2305 for file in assert.h sys
/mman.h
; do
2306 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2307 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2308 chmod +w
${LIB}/$file 2>/dev
/null
2309 chmod a
+r
${LIB}/$file 2>/dev
/null
2312 if [ -r ${LIB}/$file ]; then
2313 if egrep '"C"' ${LIB}/$file >/dev
/null
2>&1 \
2314 ||
egrep '__BEGIN_DECLS' ${LIB}/$file >/dev
/null
2>&1; then
2318 echo '#ifdef __cplusplus
2320 #endif' > ${LIB}/${file}.
sed
2321 cat ${LIB}/${file} >> ${LIB}/${file}.
sed
2322 echo '#ifdef __cplusplus
2324 #endif' >> ${LIB}/${file}.
sed
2325 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2327 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2330 # Find any include directives that use "file".
2331 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2332 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2333 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2339 # check for broken assert.h that needs stdio.h or stdlib.h
2341 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2342 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2343 chmod +w
${LIB}/$file 2>/dev
/null
2344 chmod a
+r
${LIB}/$file 2>/dev
/null
2347 if [ -r ${LIB}/$file ]; then
2348 if grep 'stderr' ${LIB}/$file >/dev
/null
2>/dev
/null
; then
2349 if grep 'include.*stdio.h' ${LIB}/$file >/dev
/null
2>/dev
/null
; then
2352 echo "Fixing $file (needs stdio.h)"
2353 echo '#include <stdio.h>' >>${LIB}/$file
2356 if grep 'exit *(' ${LIB}/$file >/dev
/null
2>/dev
/null ||
2357 grep 'abort *(' ${LIB}/$file >/dev
/null
2>/dev
/null
; then
2358 if grep 'include.*stdlib.h' ${LIB}/$file >/dev
/null
2>/dev
/null
; then
2361 echo "Fixing $file (needs stdlib.h)"
2362 echo '#ifdef __cplusplus
2364 #endif' >>${LIB}/$file
2367 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2370 # Find any include directives that use "file".
2371 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2372 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2373 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2378 # Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
2380 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2381 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2382 chmod +w
${LIB}/$file 2>/dev
/null
2383 chmod a
+r
${LIB}/$file 2>/dev
/null
2386 if [ -r ${LIB}/$file ]; then
2387 echo Fixing
$file, sbrk declaration
2388 sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \
2389 ${LIB}/$file > ${LIB}/${file}.
sed
2390 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2391 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2394 # Find any include directives that use "file".
2395 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2396 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2397 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2402 # This file on SunOS 4 has a very large macro. When the sed loop
2403 # tries pull it in, it overflows the pattern space size of the SunOS
2404 # sed (GNU sed does not have this problem). Since the file does not
2405 # require fixing, we remove it from the fixed directory.
2406 file=sundev
/ipi_error.h
2407 if [ -r ${LIB}/$file ]; then
2408 echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>"
2412 # Put cpp wrappers around these include files to avoid redeclaration
2413 # errors during multiple inclusion on m88k-tektronix-sysv3.
2414 for file in time.h sys
/time.h
; do
2415 if egrep '#ifndef' $file >/dev
/null
2>&1; then
2418 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2419 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2420 chmod +w
${LIB}/$file 2>/dev
/null
2422 if [ -r ${LIB}/$file ]; then
2423 echo Fixing
$file, to protect against multiple inclusion.
2424 cpp_wrapper
=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
2425 (echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
2426 echo "#define __GCC_GOT_${cpp_wrapper}_"
2428 echo '#endif /* !_GCC_GOT_'${cpp_wrapper}_' */') > ${LIB}/${file}.new
2429 rm -f ${LIB}/$file; mv ${LIB}/${file}.new ${LIB}/$file
2434 # Fix fcntl prototype in fcntl.h on LynxOS.
2436 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2437 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2438 chmod +w
${LIB}/$file 2>/dev
/null
2439 chmod a
+r
${LIB}/$file 2>/dev
/null
2442 if [ -r ${LIB}/$file ]; then
2443 echo Fixing
$file, fcntl declaration
2444 sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
2445 ${LIB}/$file > ${LIB}/${file}.
sed
2446 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2447 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2450 # Find any include directives that use "file".
2451 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2452 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2453 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2458 # Fix definitions of macros used by va-i960.h in VxWorks header file.
2459 file=arch
/i960
/archI960.h
2460 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2461 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2462 chmod +w
${LIB}/$file 2>/dev
/null
2463 chmod a
+r
${LIB}/$file 2>/dev
/null
2466 if [ -r ${LIB}/$file ]; then
2468 sed -e 's/__vsiz/__vxvsiz/' -e 's/__vali/__vxvali/' \
2469 -e s
'/__vpad/__vxvpad/' -e 's/__alignof__/__vxalignof__/' \
2470 ${LIB}/$file > ${LIB}/${file}.
sed
2471 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2472 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2475 # Find any include directives that use "file".
2476 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2477 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2478 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2483 # Make VxWorks header which is almost gcc ready fully gcc ready.
2484 file=types
/vxTypesBase.h
2485 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2486 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2487 chmod +w
${LIB}/$file 2>/dev
/null
2488 chmod a
+r
${LIB}/$file 2>/dev
/null
2491 if [ -r ${LIB}/$file ]; then
2493 sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
2495 #ifndef _GCC_SIZE_T\
2501 -e '/[ ]ptrdiff_t/i\
2502 #ifndef _GCC_PTRDIFF_T\
2503 #define _GCC_PTRDIFF_T
2505 -e '/[ ]ptrdiff_t/a\
2509 #ifndef _GCC_WCHAR_T\
2510 #define _GCC_WCHAR_T
2515 ${LIB}/$file > ${LIB}/${file}.
sed
2516 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2517 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2520 # Find any include directives that use "file".
2521 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2522 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2523 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2528 # Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2530 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2531 mkdir
${LIB}/sys
2>/dev
/null
2532 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2533 chmod +w
${LIB}/$file 2>/dev
/null
2534 chmod a
+r
${LIB}/$file 2>/dev
/null
2537 if [ -r ${LIB}/$file ]; then
2538 if egrep '#include' ${LIB}/$file >/dev
/null
2>&1; then
2541 if egrep 'ULONG' ${LIB}/$file >/dev
/null
2>&1 \
2542 && [ -r types
/vxTypesOld.h
]; then
2544 sed -e '/#define[ ][ ]*__INCstath/a\
2545 #include <types/vxTypesOld.h>
2547 ${LIB}/$file > ${LIB}/${file}.
sed
2548 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2551 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2554 # Find any include directives that use "file".
2555 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2556 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2557 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2562 # Fix VxWorks <time.h> to not require including <vxTypes.h>.
2564 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2565 mkdir
${LIB}/sys
2>/dev
/null
2566 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2567 chmod +w
${LIB}/$file 2>/dev
/null
2568 chmod a
+r
${LIB}/$file 2>/dev
/null
2571 if [ -r ${LIB}/$file ]; then
2572 if egrep 'uint_t[ ][ ]*_clocks_per_sec' ${LIB}/$file >/dev
/null
2>&1; then
2574 sed -e 's/uint_t/unsigned int/' ${LIB}/$file > ${LIB}/${file}.
sed
2575 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2577 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2580 # Find any include directives that use "file".
2581 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2582 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2583 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2588 # Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
2590 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2591 mkdir
${LIB}/sys
2>/dev
/null
2592 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2593 chmod +w
${LIB}/$file 2>/dev
/null
2594 chmod a
+r
${LIB}/$file 2>/dev
/null
2597 if [ -r ${LIB}/$file ]; then
2598 if egrep '^extern struct sigevent;' ${LIB}/$file >/dev
/null
2>&1; then
2600 sed -e 's/^extern struct sigevent;/struct sigevent;/' ${LIB}/$file > ${LIB}/${file}.
sed
2601 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2603 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2606 # Find any include directives that use "file".
2607 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2608 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2609 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2614 # Another bad dependency in VxWorks 5.2 <time.h>.
2616 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2617 mkdir
${LIB}/sys
2>/dev
/null
2618 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2619 chmod +w
${LIB}/$file 2>/dev
/null
2620 chmod a
+r
${LIB}/$file 2>/dev
/null
2623 if [ -r ${LIB}/$file ]; then
2624 if egrep VOIDFUNCPTR
${LIB}/$file >/dev
/null
2>&1; then
2625 if [ -r vxWorks.h
]; then
2627 sed -e '/VOIDFUNCPTR/i\
2628 #ifndef __gcc_VOIDFUNCPTR_defined\
2630 typedef void (*__gcc_VOIDFUNCPTR) (...);\
2632 typedef void (*__gcc_VOIDFUNCPTR) ();\
2634 #define __gcc_VOIDFUNCPTR_defined\
2637 -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \
2638 ${LIB}/$file > ${LIB}/${file}.
sed
2639 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2642 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2645 # Find any include directives that use "file".
2646 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2647 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2648 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2653 # This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89; gcc
2654 # doesn't understand it.
2656 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2657 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2658 chmod +w
${LIB}/$file 2>/dev
/null
2659 chmod a
+r
${LIB}/$file 2>/dev
/null
2662 if [ -r ${LIB}/$file ]; then
2663 echo "Fixing __asm directive in sys/param.h"
2664 sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \
2665 ${LIB}/$file > ${LIB}/${file}.
sed
2666 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2667 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2670 # Find any include directives that use "file".
2671 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2672 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2673 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2678 # signal.h on SunOS defines signal using (), which causes trouble when
2679 # compiling with g++ -pedantic.
2680 for file in signal.h sys
/signal.h
; do
2681 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2682 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2683 chmod +w
${LIB}/$file 2>/dev
/null
2684 chmod a
+r
${LIB}/$file 2>/dev
/null
2687 if [ -r ${LIB}/$file ]; then
2688 echo "Checking for bad C++ prototype in $file"
2689 sed -e '/^void (\*signal())();$/i\
2691 void (*signal(...))(...);\
2694 -e '/^void (\*signal())();$/a\
2697 ${LIB}/$file > ${LIB}/${file}.
sed
2698 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2699 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2702 # Find any include directives that use "file".
2703 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2704 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2705 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2711 # sys/signal.h on some versions of AIX uses volatile in the typedef of
2712 # sig_atomic_t, which causes gcc to generate a warning about duplicate
2713 # volatile when a sig_atomic_t variable is declared volatile, as
2714 # required by ANSI C.
2716 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2717 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2718 chmod +w
${LIB}/$file 2>/dev
/null
2719 chmod a
+r
${LIB}/$file 2>/dev
/null
2722 if [ -r ${LIB}/$file ]; then
2723 echo "Checking for duplicate volatile in sys/signal.h"
2724 sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' \
2725 ${LIB}/$file > ${LIB}/${file}.
sed
2726 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2727 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2730 # Find any include directives that use "file".
2731 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2732 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2733 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2738 # Some math.h files define struct exception, which conflicts with
2739 # the class exception defined in the C++ file std/stdexcept.h. We
2740 # redefine it to __math_exception. This is not a great fix, but I
2741 # haven't been able to think of anything better.
2743 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2744 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2745 chmod +w
${LIB}/$file 2>/dev
/null
2746 chmod a
+r
${LIB}/$file 2>/dev
/null
2749 if [ -r ${LIB}/$file ]; then
2750 echo Fixing
$file, exception
2751 sed -e '/struct exception/i\
2753 #define exception __math_exception\
2755 -e '/struct exception/a\
2758 #endif' ${LIB}/$file > ${LIB}/${file}.
sed
2759 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2760 if egrep 'matherr()' ${LIB}/$file >/dev
/null
2>&1; then
2763 #define exception __math_exception\
2768 #endif' ${LIB}/$file > ${LIB}/${file}.
sed
2769 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2771 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2774 # Find any include directives that use "file".
2775 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2776 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2777 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2782 # rpc/xdr.h on SunOS needs prototypes for its XDR->xdr_ops function pointers.
2784 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2785 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2786 chmod +w
${LIB}/$file 2>/dev
/null
2787 chmod a
+r
${LIB}/$file 2>/dev
/null
2790 if [ -r ${LIB}/$file ]; then
2791 echo "Checking for needed C++ prototype in $file"
2792 sed -e 's/^\(.*\)\*\(x_.*\)();\(.*\)/\
2798 $LIB/$file > ${LIB}/${file}.
sed
2800 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2801 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2804 # Find any include directives that use "file".
2805 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2806 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2807 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2812 # sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
2813 # defining regex.h related types. This causes libg++ build and usage failures.
2814 # Fixing this correctly requires checking and modifying 3 files.
2815 for file in reg_types.h regex.h sys
/lc_core.h
; do
2816 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2817 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2818 chmod +w
${LIB}/$file 2>/dev
/null
2819 chmod a
+r
${LIB}/$file 2>/dev
/null
2822 if [ -r ${LIB}/reg_types.h
]; then
2823 if egrep '} regex_t;' ${LIB}/reg_types.h
>/dev
/null
2>&1; then
2824 if [ -r ${LIB}/sys
/lc_core.h
]; then
2825 if egrep ' regex_t ' ${LIB}/sys
/lc_core.h
>/dev
/null
2>&1; then
2826 if [ -r ${LIB}/regex.h
]; then
2827 if egrep '__regex_t' ${LIB}/regex.h
>/dev
/null
2>&1; then
2830 echo Fixing reg_types.h
, regex.h
, sys
/lc_core.h
2831 for file in reg_types.h sys
/lc_core.h
; do
2832 sed -e 's/regex_t/__regex_t/g' \
2833 -e 's/regoff_t/__regoff_t/g' \
2834 -e 's/regmatch_t/__regmatch_t/g' \
2835 ${LIB}/$file > ${LIB}/${file}.
sed
2836 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2838 sed -e '/#include <reg_types.h>/a\
2839 typedef __regex_t regex_t;\
2840 typedef __regoff_t regoff_t;\
2841 typedef __regmatch_t regmatch_t;\
2843 ${LIB}/regex.h
> ${LIB}/regex.h.
sed
2844 rm -f ${LIB}/regex.h; mv ${LIB}/regex.h.sed ${LIB}/regex.h
2851 for file in reg_types.h regex.h sys
/lc_core.h
; do
2852 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2855 # Find any include directives that use "file".
2856 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2857 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2858 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2863 # AIX headers define NULL to be cast to a void pointer, which is illegal
2865 for file in curses.h dbm.h locale.h stdio.h stdlib.h string.h
time.h unistd.h
; do
2866 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2867 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2868 chmod +w
${LIB}/$file 2>/dev
/null
2869 chmod a
+r
${LIB}/$file 2>/dev
/null
2872 if [ -r ${LIB}/$file ]; then
2873 if egrep '#.*define.*NULL.*void' ${LIB}/$file >/dev
/null
2>&1; then
2874 echo "Fixing $file, bad NULL macro"
2875 sed -e 's/^#[ ]*define[ ]*NULL[ ]*((void[ ]*\*)0)/#define NULL 0/' \
2876 ${LIB}/$file > ${LIB}/${file}.
sed
2877 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2878 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2881 # Find any include directives that use "file".
2882 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2883 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2884 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2891 # This loop does not appear to do anything, because it uses file
2892 # rather than $file when setting target. It also appears to be
2893 # unnecessary, since the main loop processes symbolic links.
2895 # echo 'Making internal symbolic non-directory links'
2897 # files=`find . -type l -print`
2898 # for file in $files; do
2899 # dest=`ls -ld $file | sed -n 's/.*-> //p'`
2900 # if expr "$dest" : '[^/].*' > /dev/null; then
2901 # target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
2902 # if [ -f $target ]; then
2903 # ln -s $dest ${LIB}/$file >/dev/null 2>&1
2909 # Make sure that any include files referenced using double quotes
2910 # exist in the fixed directory. This comes last since otherwise
2911 # we might end up deleting some of these files "because they don't
2915 while [ $# != 0 ]; do
2917 while [ $# != 0 ]; do
2918 # $1 is the directory to copy from, $2 is the unfixed file,
2919 # $3 is the fixed file name.
2922 if [ -r $2 ] && [ ! -r $3 ]; then
2923 cp $2 $3 >/dev
/null
2>&1 ||
echo "Can't copy $2"
2924 chmod +w
$3 2>/dev
/null
2925 chmod a
+r
$3 2>/dev
/null
2927 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2928 dir
=`echo $2 | sed -e s'|/[^/]*$||'`
2929 dir2
=`echo $3 | sed -e s'|/[^/]*$||'`
2930 newreq
="$newreq $1 $dir/$include $dir2/$include"
2939 echo 'Cleaning up DONE files.'
2941 find .
-name DONE
-exec rm -f '{}' ';'
2943 echo 'Removing unneeded directories:'
2945 files
=`find . -type d -print | sort -r`
2946 for file in $files; do
2947 rmdir $LIB/$file > /dev
/null
2>&1