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.)
11 then echo fixincludes
: no output directory specified
18 # Make sure it exists.
19 if [ ! -d $LIB ]; then
21 echo fixincludes
: output dir
'`'$LIB"' cannot be created"
25 ( \
cd $LIB && touch DONE
&& rm DONE
) ||
{
26 echo fixincludes
: output dir
'`'$LIB"' is an invalid directory"
31 # Define what target system we're fixing.
33 if test -r .
/Makefile
; then
34 target_canonical
="`sed -n -e 's,^target[ ]*=[ ]*\(.*\)$,\1,p' < Makefile`"
37 # If not from the Makefile, then try config.guess
39 if test -z "${target_canonical}" ; then
40 if test -x .
/config.guess
; then
41 target_canonical
="`config.guess`" ; fi
42 test -z "${target_canonical}" && target_canonical
=unknown
44 export target_canonical
46 # # # # # # # # # # # # # # # # # # # # #
48 # Define PWDCMD as a command to use to get the working dir
49 # in the form that we want.
54 # On an Apollo, discard everything before `/usr'.
55 PWDCMD
="eval pwd | sed -e 's,.*/usr/,/usr/,'"
62 # Make LIB absolute only if needed to avoid problems with the amd.
67 cd $LIB; LIB
=`${PWDCMD}`
71 echo Fixing headers into
${LIB} for ${target_canonical} target
73 # Determine whether this system has symbolic links.
74 if ln -s X
$LIB/ShouldNotExist
2>/dev
/null
; then
75 rm -f $LIB/ShouldNotExist
77 elif ln -s X
/tmp
/ShouldNotExist
2>/dev
/null
; then
78 rm -f /tmp
/ShouldNotExist
84 # # # # # # # # # # # # # # # # # # # # #
86 # Search each input directory for broken header files.
87 # This loop ends near the end of the file.
91 INPUTLIST
="/usr/include"
96 for INPUT
in ${INPUTLIST} ; do
100 cd ${INPUT} ||
continue
104 # # # # # # # # # # # # # # # # # # # # #
106 echo Finding directories and links to directories
108 # Find all directories and all symlinks that point to directories.
109 # Put the list in $files.
110 # Each time we find a symlink, add it to newdirs
111 # so that we do another find within the dir the link points to.
112 # Note that $files may have duplicates in it;
113 # later parts of this file are supposed to ignore them.
116 while [ -n "$dirs" ] && [ $levels -gt 0 ]
118 levels
=`expr $levels - 1`
122 echo " Searching $INPUT/$d"
124 # Find all directories under $d, relative to $d, excluding $d itself.
125 # (The /. is needed after $d in case $d is a symlink.)
126 files
="$files `find $d/. -type d -print | \
127 sed -e '/\/\.$/d' -e 's@/./@/@g'`"
128 # Find all links to directories.
129 # Using `-exec test -d' in find fails on some systems,
130 # and trying to run test via sh fails on others,
131 # so this is the simplest alternative left.
132 # First find all the links, then test each one.
135 theselinks
=`find $d/. -type l -print | sed -e 's@/./@/@g'`
136 for d1
in $theselinks --dummy--
138 # If the link points to a directory,
139 # add that dir to $newdirs
143 if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
145 newdirs
="$newdirs $d1"
155 echo "All directories (including links to directories):"
158 for file in $files; do
160 if [ ! -d $LIB/$file ]
161 then mkdir
$LIB/$file
166 # treetops gets an alternating list
167 # of old directories to copy
168 # and the new directories to copy to.
169 treetops
="${INPUT} ${LIB}"
172 echo 'Making symbolic directory links'
173 for file in $files; do
174 dest
=`ls -ld $file | sed -n 's/.*-> //p'`
177 # In case $dest is relative, get to $file's dir first.
179 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
180 # Check that the target directory exists.
181 # Redirections changed to avoid bug in sh on Ultrix.
182 (cd $dest) > /dev
/null
2>&1
185 # X gets the dir that the link actually leads to.
187 # Canonicalize ${INPUT} now to minimize the time an
188 # automounter has to change the result of ${PWDCMD}.
189 cinput
=`cd ${INPUT}; ${PWDCMD}`
190 # If a link points to ., make a similar link to .
191 if [ $x = ${cinput} ]; then
192 echo $file '->' .
': Making link'
193 rm -fr ${LIB}/$file > /dev
/null
2>&1
194 ln -s .
${LIB}/$file > /dev
/null
2>&1
195 # If link leads back into ${INPUT},
196 # make a similar link here.
197 elif expr $x : "${cinput}/.*" > /dev
/null
; then
198 # Y gets the actual target dir name, relative to ${INPUT}.
199 y
=`echo $x | sed -n "s&${cinput}/&&p"`
200 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
202 sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
203 echo $file '->' $dots$y ': Making link'
204 rm -fr ${LIB}/$file > /dev
/null
2>&1
205 ln -s $dots$y ${LIB}/$file > /dev
/null
2>&1
207 # If the link is to a dir $target outside ${INPUT},
208 # repoint the link at ${INPUT}/root$target
209 # and process $target into ${INPUT}/root$target
210 # treat this directory as if it actually contained the files.
211 echo $file '->' root
$x ': Making link'
212 if [ -d $LIB/root
$x ]
218 while [ x
$dirname != x
]; do
219 component
=`echo $dirname | sed -e 's|/.*$||'`
220 mkdir
$component >/dev
/null
2>&1
222 dirmade
=$dirmade/$component
223 dirname=`echo $dirname | sed -e 's|[^/]*/||'`
226 # Duplicate directory structure created in ${LIB}/$file in new
228 for file2
in $files; do
231 dupdir
=${LIB}/root
$x/`echo $file2 | sed -n "s|^${file}/||p"`
232 echo "Duplicating ${file}'s ${dupdir}"
243 # Get the path from ${LIB} to $file, accounting for symlinks.
244 parent
=`echo "$file" | sed -e 's@/[^/]*$@@'`
245 libabs
=`cd ${LIB}; ${PWDCMD}`
246 file2
=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
247 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
248 dots
=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
249 rm -fr ${LIB}/$file > /dev
/null
2>&1
250 ln -s ${dots}root
$x ${LIB}/$file > /dev
/null
2>&1
251 treetops
="$treetops $x ${LIB}/root$x"
262 while [ $# != 0 ]; do
263 # $1 is an old directory to copy, and $2 is the new directory to copy to.
266 # The same dir can appear more than once in treetops.
267 # There's no need to scan it more than once.
273 echo Fixing directory
$1 into
$2
274 # Check .h files which are symlinks as well as those which are files.
275 # A link to a header file will not be processed by anything but this.
277 files
=`find . -name '*.h' \( -type f -o -type l \) -print`
279 files
=`find . -name '*.h' -type f -print`
281 echo Checking header files
283 # Note that BSD43_* are used on recent MIPS systems.
284 for file in $files; do
285 # This call to egrep is essential, since checking a file with egrep
286 # is much faster than actually trying to fix it.
287 # It is also essential that most files *not* match!
288 # Thus, matching every #endif is unacceptable.
289 # But the argument to egrep must be kept small, or many versions of egrep
290 # won't be able to handle it.
292 # We use the pattern [!-.0-z{|}~] instead of [^/ ] to match a noncomment
293 # following #else or #endif because some buggy egreps think [^/] matches
294 # newline, and they thus think `#else ' matches `#e[ndiflse]*[ ]+[^/ ]'.
295 # [!-.0-~] does not work properly on AIX 4.1.
297 # We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
298 # following #if or #elif that is not surrounded by __. The `a-ce-km-z'
299 # in this pattern lacks `d' and `l'; this means we don't worry about
300 # identifiers starting with `d' or `l'. This is OK, since none of the
301 # identifiers below start with `d' or `l'. It also greatly improves
302 # performance, since many files contain lines of the form `#if ... defined ...'
304 if egrep '//|[ _]_IO|CTRL|^#define.NULL|^#e[nl][ds][ief]*[ ]+[!-.0-z\{\|\}\~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-zA-Z][a-zA-Z0-9]' $file >/dev
/null
; then
305 if [ -r $file ]; then
306 cp $file $2/$file >/dev
/null
2>&1 \
307 ||
echo "Can't copy $file"
310 # The fixinc_eol stuff is to work around a bug in the sed
311 # program on HP/UX 10.20.
312 # Here is how the sed commands in braces work.
313 # (It doesn't work to put the comments inside the sed commands.)
314 # Surround each word with spaces, to simplify matching below.
315 # ANSIfy each pre-ANSI machine-dependent symbol
316 # by surrounding it with __ __.
317 # Remove the spaces that we inserted around each word.
321 s/\\$/\\*fixinc_eol*/
323 s/\\\*fixinc_eol\*/\\/g
324 s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
325 s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%
326 s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
327 s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
328 s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%
329 /\/\/[^*]/ s|//\(.*\)$|/*\1*/|
331 /[ ]_IO[A-Z]*[ ]*(/ s/\(_IO[A-Z]*[ ]*(\)\(.\),/\1'\''\2'\'',/
332 /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
333 /#[ ]*define[ ]*[ ]_IO/ s/'\''\([cgxtf]\)'\''/\1/g
334 /#[ ]*define[ ]*[ ]BSD43__IO/ s/'\''\([cgx]\)'\''/\1/g
335 /#[ ]*define[ ]*[ ]DESIOC/ s/'\''\([cdgx]\)'\''/\1/g
336 /[^A-Z0-9_]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
337 /[^A-Z0-9]_CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
338 /#[ ]*define[ ]*[ ]CTRL/ s/'\''\([cgx]\)'\''/\1/g
339 /#[ ]*define[ ]*[ ]_CTRL/ s/'\''\([cgx]\)'\''/\1/g
340 /#[ ]*define.BSD43_CTRL/ s/'\''\([cgx]\)'\''/\1/g
342 s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
344 s/ bsd4\([0-9]\) / __bsd4\1__ /g
345 s/ _*host_mips / __host_mips__ /g
346 s/ _*i386 / __i386__ /g
348 s/ is68k / __is68k__ /g
349 s/ m68k / __m68k__ /g
350 s/ mc680\([0-9]\)0 / __mc680\10__ /g
351 s/ m88k / __m88k__ /g
352 s/ _*mips / __mips__ /g
353 s/ news\([0-9]*\) / __news\1__ /g
354 s/ ns32000 / __ns32000__ /g
355 s/ pdp11 / __pdp11__ /g
358 s/ sony_news / __sony_news__ /g
359 s/ sparc / __sparc__ /g
360 s/ sun\([a-z0-9]*\) / __sun\1__ /g
361 s/ tahoe / __tahoe__ /g
362 s/ tower\([_0-9]*\) / __tower\1__ /g
363 s/ u370 / __u370__ /g
364 s/ u3b\([0-9]*\) / __u3b\1__ /g
365 s/ unix / __unix__ /g
367 s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
368 s/ _*\([Rr][34]\)000 / __\1000__ /g
369 s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
371 s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
373 /^#define.NULL[ ]/ i\
375 ' $2/$file > $2/$file.
376 mv $2/$file.
$2/$file
377 if cmp $file $2/$file >/dev
/null
2>&1 \
378 ||
egrep 'This file is part of the GNU C Library' $2/$file >/dev
/null
2>&1; then
382 # Find any include directives that use "file".
383 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $2/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
384 dir
=`echo $file | sed -e s'|/[^/]*$||'`
385 required
="$required $1 $dir/$include $2/$dir/$include"
396 # Install the proper definition of the three standard types in header files
397 # that they come from.
398 for file in sys
/types.h stdlib.h sys
/stdtypes.h stddef.h memory.h unistd.h
; do
399 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
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 size_t
, ptrdiff_t and wchar_t
in $file
408 -e '/^[ ]*\*[ ]*typedef unsigned int size_t;/N' \
409 -e 's/^\([ ]*\*[ ]*typedef unsigned int size_t;\n[ ]*\*\/\)/\1\
410 #ifndef __SIZE_TYPE__\
411 #define __SIZE_TYPE__ long unsigned int\
413 typedef __SIZE_TYPE__ size_t;\
415 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
416 #ifndef __SIZE_TYPE__\
417 #define __SIZE_TYPE__ long unsigned int\
420 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
421 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
422 #ifndef __PTRDIFF_TYPE__\
423 #define __PTRDIFF_TYPE__ long int\
426 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
427 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
428 #ifndef __WCHAR_TYPE__\
429 #define __WCHAR_TYPE__ int\
433 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\
436 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
437 ${LIB}/$file > ${LIB}/${file}.
sed
438 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
439 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
442 # Find any include directives that use "file".
443 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
444 dir
=`echo $file | sed -e s'|/[^/]*$||'`
445 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
451 # Fix #defines under Alpha OSF/1:
452 # The following files contain '#pragma extern_prefix "_FOO"' followed by
453 # a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
454 # statements is to reduce namespace pollution. While these macros work
455 # properly in most cases, they don't allow you to take a pointer to the
456 # "something" being modified. To get around this limitation, change these
457 # statements to be of the form '#define something _FOOsomething'.
458 for file in libgen.h dirent.h ftw.h grp.h ndbm.h pthread.h
pwd.h signal.h standards.h stdlib.h string.h stropts.h
time.h unistd.h
460 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
461 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
462 chmod +w
${LIB}/$file 2>/dev
/null
463 chmod a
+r
${LIB}/$file 2>/dev
/null
466 if [ -r ${LIB}/$file ]; then
467 echo Fixing
$file extern_prefix
468 sed -e 's/^[ ]*#[ ]*define[ ]*\([^(]*\)\(([^)]*)\)[ ]*\(_.\)\1\2[ ]*$/#define \1 \3\1/' ${LIB}/$file > ${LIB}/${file}.
sed
469 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
470 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
473 # Find any include directives that use "file".
474 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
475 dir
=`echo $file | sed -e s'|/[^/]*$||'`
476 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
482 # Fix one other error in this file: a mismatched quote not inside a C comment.
483 file=sundev
/vuid_event.h
484 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
485 mkdir
${LIB}/sundev
2>/dev
/null
486 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
487 chmod +w
${LIB}/$file 2>/dev
/null
488 chmod a
+r
${LIB}/$file 2>/dev
/null
491 if [ -r ${LIB}/$file ]; then
492 echo Fixing
$file comment
493 sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.
sed
494 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
495 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
498 # Find any include directives that use "file".
499 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
500 dir
=`echo $file | sed -e s'|/[^/]*$||'`
501 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
506 # Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
507 file=sunwindow
/win_cursor.h
508 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
509 # mkdir ${LIB}/sunwindow 2>/dev/null
510 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
511 chmod +w
${LIB}/$file 2>/dev
/null
513 if [ -r ${LIB}/$file ]; then
515 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
516 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
517 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
520 # Find any include directives that use "file".
521 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
522 dir
=`echo $file | sed -e s'|/[^/]*$||'`
523 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
527 file=sunwindow
/win_lock.h
528 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
529 # mkdir ${LIB}/sunwindow 2>/dev/null
530 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
531 chmod +w
${LIB}/$file 2>/dev
/null
533 if [ -r ${LIB}/$file ]; then
535 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
536 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
537 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
540 # Find any include directives that use "file".
541 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
542 dir
=`echo $file | sed -e s'|/[^/]*$||'`
543 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
548 # Fix this Sun file to avoid interfering with stddef.h.
550 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
551 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
552 chmod +w
${LIB}/$file 2>/dev
/null
553 chmod a
+r
${LIB}/$file 2>/dev
/null
556 if [ -r ${LIB}/$file ]; then
558 sed -e '/[ ]size_t.*;/i\
565 -e '/[ ]ptrdiff_t.*;/i\
566 #ifndef _GCC_PTRDIFF_T\
567 #define _GCC_PTRDIFF_T
569 -e '/[ ]ptrdiff_t.*;/a\
572 -e '/[ ]wchar_t.*;/i\
573 #ifndef _GCC_WCHAR_T\
576 -e '/[ ]wchar_t.*;/a\
578 ' ${LIB}/$file > ${LIB}/${file}.
sed
579 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
580 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
583 # Find any include directives that use "file".
584 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
585 dir
=`echo $file | sed -e s'|/[^/]*$||'`
586 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
591 # Fix this ARM/RISCiX file to avoid interfering with the use of __wchar_t
594 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
595 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
596 chmod +w
${LIB}/$file 2>/dev
/null
597 chmod a
+r
${LIB}/$file 2>/dev
/null
600 if [ -r ${LIB}/$file ]; then
602 sed -e "s/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
603 -e "s/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
604 ${LIB}/$file > ${LIB}/${file}.
sed
605 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
606 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
609 # Find any include directives that use "file".
610 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
611 dir
=`echo $file | sed -e s'|/[^/]*$||'`
612 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
617 # Fix this ARM/RISCiX file where ___type is a Compiler hint that is specific to
618 # the Norcroft compiler.
620 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
621 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
622 chmod +w
${LIB}/$file 2>/dev
/null
623 chmod a
+r
${LIB}/$file 2>/dev
/null
626 if [ -r ${LIB}/$file ]; then
628 sed -e "s/___type p_type/p_type/" \
629 ${LIB}/$file > ${LIB}/${file}.
sed
630 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
631 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
634 # Find any include directives that use "file".
635 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
636 dir
=`echo $file | sed -e s'|/[^/]*$||'`
637 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
642 # Fix this file to avoid interfering with stddef.h, but don't mistakenly
643 # match ssize_t present in AIX for the ps/2, or typedefs which use (but do not
646 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
647 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
648 chmod +w
${LIB}/$file 2>/dev
/null
649 chmod a
+r
${LIB}/$file 2>/dev
/null
652 if [ -r ${LIB}/$file ]; then
654 sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
658 -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
660 ' ${LIB}/$file > ${LIB}/${file}.
sed
661 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
662 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
665 # Find any include directives that use "file".
666 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
667 dir
=`echo $file | sed -e s'|/[^/]*$||'`
668 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
673 # Fix HP's use of ../machine/inline.h to refer to
674 # /usr/include/machine/inline.h
676 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
677 cp $file ${LIB}/$file
679 if [ -r ${LIB}/$file ] ; then
681 sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
682 -e 's,"../machine/psl.h",<machine/psl.h>,' \
683 ${LIB}/$file > ${LIB}/${file}.
sed
684 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
685 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
688 # Find any include directives that use "file".
689 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
690 dir
=`echo $file | sed -e s'|/[^/]*$||'`
691 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
696 # Fix an error in this file: the #if says _cplusplus, not the double
697 # underscore __cplusplus that it should be
699 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
700 mkdir
${LIB}/rpcsvc
2>/dev
/null
701 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
702 chmod +w
${LIB}/$file 2>/dev
/null
703 chmod a
+r
${LIB}/$file 2>/dev
/null
706 if [ -r ${LIB}/$file ]; then
707 echo Fixing
$file, __cplusplus macro
708 sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.
sed
709 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
710 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
713 # Find any include directives that use "file".
714 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
715 dir
=`echo $file | sed -e s'|/[^/]*$||'`
716 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
721 # Fix an error in this file: a missing semi-colon at the end of the statsswtch
722 # structure definition.
724 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
725 mkdir
${LIB}/rpcsvc
2>/dev
/null
726 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
727 chmod +w
${LIB}/$file 2>/dev
/null
728 chmod a
+r
${LIB}/$file 2>/dev
/null
731 if [ -r ${LIB}/$file ]; then
732 echo Fixing
$file, definition of statsswtch
733 sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.
sed
734 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
735 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
738 # Find any include directives that use "file".
739 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
740 dir
=`echo $file | sed -e s'|/[^/]*$||'`
741 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
746 # Fix an error in this file: a missing semi-colon at the end of the nodeent
747 # structure definition.
748 file=netdnet
/dnetdb.h
749 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
750 mkdir
${LIB}/netdnet
2>/dev
/null
751 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
752 chmod +w
${LIB}/$file 2>/dev
/null
753 chmod a
+r
${LIB}/$file 2>/dev
/null
756 if [ -r ${LIB}/$file ]; then
757 echo Fixing
$file, definition of nodeent
758 sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.
sed
759 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
760 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
763 # Find any include directives that use "file".
764 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
765 dir
=`echo $file | sed -e s'|/[^/]*$||'`
766 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
771 # Check for bad #ifdef line (in Ultrix 4.1)
773 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
774 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
775 chmod +w
${LIB}/$file 2>/dev
/null
776 chmod a
+r
${LIB}/$file 2>/dev
/null
779 if [ -r ${LIB}/$file ]; then
780 echo Fixing
$file, bad \
#ifdef line
781 sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.
sed
782 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
783 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
786 # Find any include directives that use "file".
787 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
788 dir
=`echo $file | sed -e s'|/[^/]*$||'`
789 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
794 # Check for (...) in C++ code in HP/UX sys/file.h.
796 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
797 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
798 chmod +w
${LIB}/$file 2>/dev
/null
799 chmod a
+r
${LIB}/$file 2>/dev
/null
802 if [ -r ${LIB}/$file ]; then
803 if egrep HPUX_SOURCE
${LIB}/$file > /dev
/null
; then
804 echo Fixing
$file, use of
'(...)'
805 sed -e 's/(\.\.\.)/(struct file * ...)/' ${LIB}/$file > ${LIB}/${file}.
sed
806 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
807 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
810 # Find any include directives that use "file".
811 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
812 dir
=`echo $file | sed -e s'|/[^/]*$||'`
813 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
819 # Check for superfluous `static' (in Ultrix 4.2)
820 # On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
822 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
823 mkdir
${LIB}/machine
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
830 echo Fixing
$file, superfluous static and broken includes of other files.
831 sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
832 -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
833 -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
834 ${LIB}/$file > ${LIB}/${file}.
sed
835 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
836 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
839 # Find any include directives that use "file".
840 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
841 dir
=`echo $file | sed -e s'|/[^/]*$||'`
842 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
844 # This file has an alternative name, mips/cpu.h. Fix that name, too.
845 if cmp machine
/cpu.h mips
/cpu.h
> /dev
/null
2>&1; then
846 mkdir
${LIB}/mips
2>&-
847 # Don't remove the file first, they may be the same file!
848 ln ${LIB}/$file ${LIB}/mips
/cpu.h
> /dev
/null
2>&1
853 # Incorrect sprintf declaration in X11/Xmu.h
855 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
856 mkdir
${LIB}/X11
2>/dev
/null
857 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
858 chmod +w
${LIB}/$file 2>/dev
/null
859 chmod a
+r
${LIB}/$file 2>/dev
/null
862 if [ -r ${LIB}/$file ]; then
863 echo Fixing
$file sprintf declaration
864 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
865 extern char * sprintf();\
866 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
867 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
868 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
871 # Find any include directives that use "file".
872 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
873 dir
=`echo $file | sed -e s'|/[^/]*$||'`
874 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
879 # Incorrect sprintf declaration in X11/Xmu/Xmu.h
880 # (It's not clear whether the right file name is this or X11/Xmu.h.)
882 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
883 mkdir
${LIB}/X11
/Xmu
2>/dev
/null
884 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
885 chmod +w
${LIB}/$file 2>/dev
/null
886 chmod a
+r
${LIB}/$file 2>/dev
/null
889 if [ -r ${LIB}/$file ]; then
890 echo Fixing
$file sprintf declaration
891 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
892 extern char * sprintf();\
893 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
894 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
895 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
898 # Find any include directives that use "file".
899 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
900 dir
=`echo $file | sed -e s'|/[^/]*$||'`
901 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
906 # Check for missing ';' in struct
908 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
909 mkdir
${LIB}/netinet
2>/dev
/null
910 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
911 chmod +w
${LIB}/$file 2>/dev
/null
912 chmod a
+r
${LIB}/$file 2>/dev
/null
915 if [ -r ${LIB}/$file ]; then
917 sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.
sed
918 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
919 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
922 # Find any include directives that use "file".
923 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
924 dir
=`echo $file | sed -e s'|/[^/]*$||'`
925 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
930 # Fix the CAT macro in SunOS memvar.h.
931 file=pixrect
/memvar.h
932 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
933 mkdir
${LIB}/pixrect
2>/dev
/null
934 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
935 chmod +w
${LIB}/$file 2>/dev
/null
936 chmod a
+r
${LIB}/$file 2>/dev
/null
939 if [ -r ${LIB}/$file ]; then
941 sed -e '/^#define.CAT(a,b)/ i\
943 #define CAT(a,b) a##b\
945 /^#define.CAT(a,b)/ a\
947 ' ${LIB}/$file > ${LIB}/${file}.
sed
948 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
949 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
952 # Find any include directives that use "file".
953 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
954 dir
=`echo $file | sed -e s'|/[^/]*$||'`
955 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
960 # Check for yet more missing ';' in struct (in SunOS 4.0.x)
962 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
963 mkdir
${LIB}/rpcsvc
2>/dev
/null
964 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
965 chmod +w
${LIB}/$file 2>/dev
/null
966 chmod a
+r
${LIB}/$file 2>/dev
/null
969 if [ -r ${LIB}/$file ]; then
971 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.
sed
972 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
973 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
976 # Find any include directives that use "file".
977 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
978 dir
=`echo $file | sed -e s'|/[^/]*$||'`
979 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
984 # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
985 # Also wrap protection around size_t for m88k-sysv3 systems.
987 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
988 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
989 chmod +w
${LIB}/$file 2>/dev
/null
990 chmod a
+r
${LIB}/$file 2>/dev
/null
993 if [ -r ${LIB}/$file ]; then
995 if grep _GCC_SIZE_T
${LIB}/$file >/dev
/null
996 then size_t_pattern
='<<< do not double-wrap the size_t typedef >>>'
997 else size_t_pattern
='typedef[ a-zA-Z_]*[ ]size_t[ ]*;'
999 sed -e 's/int abort/void abort/g' \
1000 -e 's/int free/void free/g' \
1001 -e 's/char[ ]*\*[ ]*calloc/void \* calloc/g' \
1002 -e 's/char[ ]*\*[ ]*malloc/void \* malloc/g' \
1003 -e 's/char[ ]*\*[ ]*realloc/void \* realloc/g' \
1004 -e 's/int[ ][ ]*exit/void exit/g' \
1005 -e "/$size_t_pattern/"'i\
1006 #ifndef _GCC_SIZE_T\
1009 -e "/$size_t_pattern/"'a\
1012 ${LIB}/$file > ${LIB}/${file}.
sed
1013 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1014 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1017 # Find any include directives that use "file".
1018 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1019 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1020 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1025 # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
1026 # Also fix return type of {m,re}alloc in <malloc.h> on sysV68
1028 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1029 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1030 chmod +w
${LIB}/$file 2>/dev
/null
1031 chmod a
+r
${LIB}/$file 2>/dev
/null
1034 if [ -r ${LIB}/$file ]; then
1036 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
1037 -e 's/int[ ][ ]*free/void free/g' \
1038 -e 's/char\([ ]*\*[ ]*malloc\)/void\1/g' \
1039 -e 's/char\([ ]*\*[ ]*realloc\)/void\1/g' \
1040 ${LIB}/$file > ${LIB}/${file}.
sed
1041 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1042 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1045 # Find any include directives that use "file".
1046 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1047 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1048 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1053 # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
1054 file=hsfs
/hsfs_spec.h
1055 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1056 mkdir
${LIB}/hsfs
2>/dev
/null
1057 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1058 chmod +w
${LIB}/$file 2>/dev
/null
1059 chmod a
+r
${LIB}/$file 2>/dev
/null
1062 if [ -r ${LIB}/$file ]; then
1064 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
1065 ${LIB}/$file > ${LIB}/${file}.
1066 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
1067 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1070 # Find any include directives that use "file".
1071 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1072 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1073 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1078 # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
1080 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1081 mkdir
${LIB}/hsfs
2>/dev
/null
1082 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1083 chmod +w
${LIB}/$file 2>/dev
/null
1084 chmod a
+r
${LIB}/$file 2>/dev
/null
1087 if [ -r ${LIB}/$file ]; then
1089 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
1090 ${LIB}/$file > ${LIB}/${file}.
sed
1091 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1092 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1095 # Find any include directives that use "file".
1096 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1097 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1098 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1103 # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
1104 file=hsfs
/iso_spec.h
1105 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1106 mkdir
${LIB}/hsfs
2>/dev
/null
1107 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1108 chmod +w
${LIB}/$file 2>/dev
/null
1109 chmod a
+r
${LIB}/$file 2>/dev
/null
1112 if [ -r ${LIB}/$file ]; then
1114 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
1115 ${LIB}/$file > ${LIB}/${file}.
sed
1116 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1117 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1120 # Find any include directives that use "file".
1121 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1122 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1123 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1128 # Incorrect #include in Sony News-OS 3.2.
1129 file=machine
/machparam.h
1130 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1131 mkdir
${LIB}/machine
2>/dev
/null
1132 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1133 chmod +w
${LIB}/$file 2>/dev
/null
1134 chmod a
+r
${LIB}/$file 2>/dev
/null
1137 if [ -r ${LIB}/$file ]; then
1138 echo Fixing
$file, incorrect \
#include
1139 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
1140 ${LIB}/$file > ${LIB}/${file}.
1141 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
1142 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1145 # Find any include directives that use "file".
1146 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1147 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1148 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1153 # Multiline comment after typedef on IRIX 4.0.1.
1155 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1156 mkdir
${LIB}/sys
2>/dev
/null
1157 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1158 chmod +w
${LIB}/$file 2>/dev
/null
1159 chmod a
+r
${LIB}/$file 2>/dev
/null
1162 if [ -r ${LIB}/$file ]; then
1163 echo Fixing
$file, comment
in the middle of \
#ifdef
1164 sed -e 's@type of the result@type of the result */@' \
1165 -e 's@of the sizeof@/* of the sizeof@' \
1166 ${LIB}/$file > ${LIB}/${file}.
sed
1167 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1168 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1171 # Find any include directives that use "file".
1172 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1173 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1174 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1179 # Turning // comments into /* */ comments trashes this IRIX 4.0.1
1180 # header file, which embeds // comments inside multi-line /* */
1181 # comments. If this looks like the IRIX header file, we refix it by
1182 # just throwing away the // comments.
1184 if [ -r ${LIB}/$file ]; then
1185 if egrep indigo.esd
${LIB}/$file > /dev
/null
; then
1186 echo Fixing
$file, overeager
sed script
1188 sed -e 's|//.*$||g' $file > ${LIB}/$file
1189 chmod +w
${LIB}/$file 2>/dev
/null
1190 chmod a
+r
${LIB}/$file 2>/dev
/null
1194 # There is a similar problem with the VxWorks drv/netif/if_med.h file.
1195 file=drv
/netif
/if_med.h
1196 if [ -r ${LIB}/$file ]; then
1197 if egrep 'Wind River' ${LIB}/$file > /dev
/null
; then
1198 echo Fixing
$file, overeager
sed script
1200 sed -e 's|//.*$||g' $file > ${LIB}/$file
1201 chmod +w
${LIB}/$file 2>/dev
/null
1202 chmod a
+r
${LIB}/$file 2>/dev
/null
1206 # And also with the HP-UX 10 and HP-UX 11 sys/pci.h file
1208 if [ -r ${LIB}/$file ]; then
1209 if egrep 'System Private Structures' ${LIB}/$file > /dev
/null
; then
1210 echo Fixing
$file, overeager
sed script
1212 sed -e 's|//.*$||g' $file > ${LIB}/$file
1213 chmod +w
${LIB}/$file 2>/dev
/null
1214 chmod a
+r
${LIB}/$file 2>/dev
/null
1218 # And also with a few more HP-UX 11 headers which are only broken
1219 # after they are "fixed".
1221 if [ -r ${LIB}/$file ]; then
1222 if egrep 'These definitions are for HP Internal developers' ${LIB}/$file > /dev
/null
; then
1223 echo Fixing
$file, overeager
sed script
1229 if [ -r ${LIB}/$file ]; then
1230 if egrep '11.00 HP-UX LP64' ${LIB}/$file > /dev
/null
; then
1231 echo Fixing
$file, overeager
sed script
1237 if [ -r ${LIB}/$file ]; then
1238 if egrep 'KI_MAX_PROCS is an arbitrary number' ${LIB}/$file > /dev
/null
; then
1239 echo Fixing
$file, overeager
sed script
1245 if [ -r ${LIB}/$file ] ; then
1246 if egrep 'Kernel Instrumentation Definitions' ${LIB}/$file > /dev
/null
; then
1247 echo Fixing
$file, overeager
sed script
1253 if [ -r ${LIB}/$file ] ; then
1254 if egrep 'For CASPEC, look in' ${LIB}/$file > /dev
/null
; then
1255 echo Fixing
$file, overeager
sed script
1260 # Some IRIX header files contains the string "//"
1261 for file in elf_abi.h elf.h
; do
1262 if [ -r ${LIB}/$file ]; then
1263 echo Fixing
$file, overeager
sed script
1264 sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.
sed
1265 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1266 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1269 # Find any include directives that use "file".
1270 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1271 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1272 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1278 # IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr in prototype without
1279 # previous definition.
1281 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1282 mkdir
${LIB}/rpc
2>/dev
/null
1283 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1284 chmod +w
${LIB}/$file 2>/dev
/null
1285 chmod a
+r
${LIB}/$file 2>/dev
/null
1288 if [ -r ${LIB}/$file ]; then
1289 echo Fixing
$file, undefined
type
1290 sed -e '/authdes_create.*struct sockaddr/i\
1293 ${LIB}/$file > ${LIB}/$file.
sed
1294 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1295 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1298 # Find any include directives that use "file".
1299 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1300 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1301 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1306 # IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s in prototype without previous
1309 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1310 mkdir
${LIB}/rpc
2>/dev
/null
1311 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1312 chmod +w
${LIB}/$file 2>/dev
/null
1313 chmod a
+r
${LIB}/$file 2>/dev
/null
1316 if [ -r ${LIB}/$file ]; then
1317 echo Fixing
$file, undefined
type
1318 sed -e '/xdrstdio_create.*struct __file_s/i\
1321 ${LIB}/$file > ${LIB}/$file.
sed
1322 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1323 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1326 # Find any include directives that use "file".
1327 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1328 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1329 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1334 # Same problem with a file from SunOS 4.1.3 : a header file containing
1335 # the string "//" embedded in "/**/"
1336 file=sbusdev
/audiovar.h
1337 if [ -r ${LIB}/$file ]; then
1338 echo Fixing
$file, overeager
sed script
1340 sed -e 's|//.*$||g' $file > ${LIB}/$file
1341 chmod +w
${LIB}/$file 2>/dev
/null
1342 chmod a
+r
${LIB}/$file 2>/dev
/null
1345 # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
1346 # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
1347 # many other systems have similar text but correct versions of the file.
1348 # To ensure only Sun's is fixed, we grep for a likely unique string.
1349 # Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
1351 if [ -r $file ] && egrep '/\* @\(#\)(head/memory.h 50.1 |memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 )\*/' $file > /dev
/null
; then
1352 if [ ! -r ${LIB}/$file ]; then
1353 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1354 chmod +w
${LIB}/$file 2>/dev
/null
1355 chmod a
+r
${LIB}/$file 2>/dev
/null
1357 if [ -r ${LIB}/$file ]; then
1358 echo Replacing
$file
1359 cat > ${LIB}/$file << EOF
1360 /* This file was generated by fixincludes */
1361 #ifndef __memory_h__
1362 #define __memory_h__
1365 extern void *memccpy();
1366 extern void *memchr();
1367 extern void *memcpy();
1368 extern void *memset();
1370 extern char *memccpy();
1371 extern char *memchr();
1372 extern char *memcpy();
1373 extern char *memset();
1374 #endif /* __STDC__ */
1376 extern int memcmp();
1378 #endif /* __memory_h__ */
1383 # Fix return type of fread and fwrite on sysV68
1385 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1386 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1387 chmod +w
${LIB}/$file 2>/dev
/null
1388 chmod a
+r
${LIB}/$file 2>/dev
/null
1391 if [ -r ${LIB}/$file ]; then
1392 echo Fixing
$file, fread and fwrite
return type
1393 sed -e 's/^\(extern int fclose(), fflush()\), \(fread(), fwrite()\)\(.*\)$/extern unsigned int \2;\
1395 ${LIB}/$file > ${LIB}/${file}.
sed
1396 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1397 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1400 # Find any include directives that use "file".
1401 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1402 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1403 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1408 # parameters not const on DECstation Ultrix V4.0 and OSF/1.
1410 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1411 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1412 chmod +w
${LIB}/$file 2>/dev
/null
1413 chmod a
+r
${LIB}/$file 2>/dev
/null
1416 if [ -r ${LIB}/$file ]; then
1417 echo Fixing
$file, non-const arg
1418 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
1419 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
1420 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
1421 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
1422 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
1423 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
1424 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
1425 -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
1426 -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
1427 ${LIB}/$file > ${LIB}/${file}.
sed
1428 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1429 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1432 # Find any include directives that use "file".
1433 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1434 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1435 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1440 # parameters conflict with C++ new on rs/6000
1441 for file in stdio.h unistd.h
; do
1442 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1443 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1444 chmod +w
${LIB}/$file 2>/dev
/null
1447 if [ -r ${LIB}/$file ]; then
1448 echo Fixing
$file, parameter name conflicts
1449 sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
1450 ${LIB}/$file > ${LIB}/${file}.
sed
1451 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1452 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1455 # Find any include directives that use "file".
1456 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1457 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1458 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1464 # function class(double x) conflicts with C++ keyword on rs/6000
1466 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1467 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1468 chmod +w
${LIB}/$file 2>/dev
/null
1469 chmod a
+r
${LIB}/$file 2>/dev
/null
1472 if [ -r ${LIB}/$file ]; then
1473 if grep '[^a-zA-Z_]class[(]' ${LIB}/$file >/dev
/null
; then
1475 sed -e '/class[(]/i\
1480 ' ${LIB}/$file > ${LIB}/${file}.
sed
1481 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1482 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1485 # Find any include directives that use "file".
1486 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1487 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1488 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1494 # Wrong fchmod prototype on RS/6000.
1496 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1497 mkdir
${LIB}/sys
2>/dev
/null
1498 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1499 chmod +w
${LIB}/$file 2>/dev
/null
1500 chmod a
+r
${LIB}/$file 2>/dev
/null
1503 if [ -r ${LIB}/$file ]; then
1504 echo Fixing
$file, fchmod prototype
1505 sed -e 's/fchmod(char \*/fchmod(int/' \
1506 ${LIB}/$file > ${LIB}/$file.
sed
1507 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1508 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1511 # Find any include directives that use "file".
1512 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1513 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1514 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1519 # There are several name conflicts with C++ reserved words in X11
1520 # header files. These are fixed in some versions, so don't do the
1521 # fixes if we find __cplusplus in the file. These were found on the
1524 # class in X11/ShellP.h
1526 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1527 mkdir
${LIB}/sys
2>/dev
/null
1528 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1529 chmod +w
${LIB}/$file 2>/dev
/null
1530 chmod a
+r
${LIB}/$file 2>/dev
/null
1533 if [ -r ${LIB}/$file ]; then
1534 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1537 echo Fixing
$file, field class
1538 sed -e '/char [*]class;/i\
1543 -e '/char [*]class;/a\
1545 ' ${LIB}/$file > ${LIB}/${file}.
sed
1546 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1548 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1551 # Find any include directives that use "file".
1552 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1553 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1554 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1558 # new in Xm/Traversal.h
1560 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1561 mkdir
${LIB}/sys
2>/dev
/null
1562 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1563 chmod +w
${LIB}/$file 2>/dev
/null
1564 chmod a
+r
${LIB}/$file 2>/dev
/null
1567 if [ -r ${LIB}/$file ]; then
1568 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1571 echo Fixing
$file, uses of new
1572 sed -e '/Widget old, new;/i\
1577 -e '/Widget old, new;/a\
1580 -e 's/Widget new,/Widget c_new,/g' ${LIB}/$file > ${LIB}/${file}.
sed
1581 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1583 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1586 # Find any include directives that use "file".
1587 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1588 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1589 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1593 # class in Xm/BaseClassI.h
1594 file=Xm
/BaseClassI.h
1595 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1596 mkdir
${LIB}/sys
2>/dev
/null
1597 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1598 chmod +w
${LIB}/$file 2>/dev
/null
1599 chmod a
+r
${LIB}/$file 2>/dev
/null
1602 if [ -r ${LIB}/$file ]; then
1603 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1606 echo Fixing
$file, prototype parameter name
1607 sed -e 's/ class[)]/ c_class)/g' ${LIB}/$file > ${LIB}/${file}.
sed
1608 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1610 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1613 # Find any include directives that use "file".
1614 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1615 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1616 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1621 # NeXT 3.2 adds const prefix to some math functions. These conflict
1622 # with the built-in functions.
1624 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1625 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1626 chmod +w
${LIB}/$file 2>/dev
/null
1628 if [ -r ${LIB}/$file ]; then
1630 sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \
1631 -e '/^extern.*double.*__const__.*fabs(/s/__const__//' \
1632 -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
1633 -e '/^extern.*double.*__const__.*hypot(/s/__const__//' \
1634 -e '/^extern.*double.*__const__.*sin(/s/__const__//' ${LIB}/$file > ${LIB}/${file}.
sed
1635 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1636 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1639 # Find any include directives that use "file".
1640 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1641 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1642 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1647 # NeXT 3.2 uses the word "template" as a parameter for some
1648 # functions. GCC reports an invalid use of a reserved key word
1649 # with the built-in functions. NeXT 3.2 includes the keyword
1650 # volatile in the prototype for abort(). This conflicts with
1651 # the built-in definition.
1653 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1654 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1655 chmod +w
${LIB}/$file 2>/dev
/null
1657 if [ -r ${LIB}/$file ]; then
1659 sed -e '/\(.*template\)/s/template//' \
1660 -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.
sed
1661 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1662 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1665 # Find any include directives that use "file".
1666 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1667 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1668 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1673 # NeXT 3.2 includes the keyword volatile in the abort() and
1674 # exit() function prototypes. That conflicts with the
1675 # built-in functions.
1677 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1678 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1679 chmod +w
${LIB}/$file 2>/dev
/null
1681 if [ -r ${LIB}/$file ]; then
1683 sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
1684 -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.
sed
1685 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1686 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1689 # Find any include directives that use "file".
1690 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1691 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1692 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1697 # sys/utsname.h on Ultrix V4.[35] puts the declaration of uname before the
1698 # definition of struct utsname, so the prototype (added by fixproto) causes
1701 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1702 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1703 chmod +w
${LIB}/$file 2>/dev
/null
1706 if [ -r ${LIB}/$file ] \
1707 && grep 'ULTRIX' ${LIB}/$file >/dev
/null
; then
1708 echo Fixing
$file, uname declaration
1709 sed -e '/^[ ]*extern[ ]*int[ ]*uname();$/i\
1712 ${LIB}/$file > ${LIB}/${file}.
sed
1713 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1714 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1717 # Find any include directives that use "file".
1718 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1719 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1720 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1725 # sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
1726 # of struct rusage, so the prototype (added by fixproto) causes havoc.
1728 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1729 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1730 chmod +w
${LIB}/$file 2>/dev
/null
1733 if [ -r ${LIB}/$file ] \
1734 && grep 'bos325,' ${LIB}/$file >/dev
/null
; then
1735 echo Fixing
$file, wait3 declaration
1736 sed -e '/^extern pid_t wait3();$/i\
1739 ${LIB}/$file > ${LIB}/${file}.
sed
1740 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1741 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1744 # Find any include directives that use "file".
1745 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1746 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1747 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1752 # NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1753 # Note that version 3 of the NeXT system has wait.h in a different directory,
1754 # so that this code won't do anything. But wait.h in version 3 has a
1755 # conditional, so it doesn't need this fix. So everything is okay.
1757 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1758 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1759 chmod +w
${LIB}/$file 2>/dev
/null
1762 if [ -r ${LIB}/$file ] \
1763 && grep 'wait[(]union wait' ${LIB}/$file >/dev
/null
; then
1764 echo Fixing
$file, bad
wait formal
1765 sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.
sed
1766 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1767 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1770 # Find any include directives that use "file".
1771 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1772 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1773 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1778 # Don't use or define the name va_list in stdio.h.
1779 # This is for ANSI and also to interoperate properly with gcc's varargs.h.
1781 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1782 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1783 chmod +w
${LIB}/$file 2>/dev
/null
1784 chmod a
+r
${LIB}/$file 2>/dev
/null
1787 if [ -r ${LIB}/$file ]; then
1788 echo Fixing
$file, use of va_list
1789 # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1790 if egrep "__need___va_list" ${LIB}/$file >/dev
/null
2>&1; then
1791 touch ${LIB}/${file}.
sed
1793 (echo "#define __need___va_list"
1794 echo "#include <stdarg.h>") > ${LIB}/${file}.
sed
1796 # Use __gnuc_va_list in arg types in place of va_list.
1797 # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1798 # trailing parentheses and semicolon save all other systems from this.
1799 # Define __va_list__ (something harmless and unused) instead of va_list.
1800 # Don't claim to have defined va_list.
1801 sed -e 's@ va_list @ __gnuc_va_list @' \
1802 -e 's@ va_list)@ __gnuc_va_list)@' \
1803 -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
1804 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
1805 -e 's@ va_list@ __va_list__@' \
1806 -e 's@\*va_list@*__va_list__@' \
1807 -e 's@ __va_list)@ __gnuc_va_list)@' \
1808 -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
1809 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
1810 -e 's@VA_LIST@DUMMY_VA_LIST@' \
1811 -e 's@_Va_LIST@_VA_LIST@' \
1812 ${LIB}/$file >> ${LIB}/${file}.
sed
1814 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1815 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1818 # Find any include directives that use "file".
1819 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1820 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1821 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1826 # Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
1828 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1829 if grep -s ULTRIX
$file; then
1830 echo "/* This file intentionally left blank. */" > $LIB/$file
1834 # parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
1835 # also get rid of bogus inline definitions in HP-UX 8.0
1837 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1838 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1839 chmod +w
${LIB}/$file 2>/dev
/null
1840 chmod a
+r
${LIB}/$file 2>/dev
/null
1843 if [ -r ${LIB}/$file ]; then
1844 echo Fixing
$file, non-const arg
1845 sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \
1846 -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
1847 -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
1848 -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
1849 -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
1850 ${LIB}/$file > ${LIB}/${file}.
sed
1851 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1852 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1855 # Find any include directives that use "file".
1856 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1857 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1858 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1863 # fix bogus recursive stdlib.h in NEWS-OS 4.0C
1865 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1866 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1867 chmod +w
${LIB}/$file 2>/dev
/null
1868 chmod a
+r
${LIB}/$file 2>/dev
/null
1871 if [ -r ${LIB}/$file ]; then
1872 echo Fixing
$file, recursive inclusion
1873 sed -e '/^#include <stdlib.h>/i\
1876 -e '/^#include <stdlib.h>/a\
1879 ${LIB}/$file > ${LIB}/${file}.
sed
1880 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1881 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1884 # Find any include directives that use "file".
1885 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1886 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1887 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1892 # Avoid nested comments on Ultrix 4.3.
1894 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1895 mkdir
${LIB}/rpc
2>/dev
/null
1896 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1897 chmod +w
${LIB}/$file 2>/dev
/null
1898 chmod a
+r
${LIB}/$file 2>/dev
/null
1901 if [ -r ${LIB}/$file ]; then
1902 echo Fixing
$file, nested comment
1903 sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
1904 ${LIB}/$file > ${LIB}/$file.
sed
1905 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1906 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1909 # Find any include directives that use "file".
1910 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1911 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1912 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1917 # This file in RISC/os uses /**/ to concatenate two tokens.
1919 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1920 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1921 chmod +w
${LIB}/$file 2>/dev
/null
1922 chmod a
+r
${LIB}/$file 2>/dev
/null
1924 if [ -r ${LIB}/$file ]; then
1925 sed -e 's|/\*\*/|##|' ${LIB}/$file > ${LIB}/${file}.
sed
1926 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1927 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1930 # Find any include directives that use "file".
1931 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1932 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1933 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1939 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1940 mkdir
${LIB}/rpc
2>/dev
/null
1941 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1942 chmod +w
${LIB}/$file 2>/dev
/null
1943 chmod a
+r
${LIB}/$file 2>/dev
/null
1946 if [ -r ${LIB}/$file ]; then
1947 echo Fixing
$file, nested comment
1948 sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
1949 ${LIB}/$file > ${LIB}/$file.
sed
1950 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1951 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1954 # Find any include directives that use "file".
1955 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1956 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1957 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1962 # rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
1963 # is defined for the alpha. The problem is the declaration of malloc.
1965 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1966 mkdir
${LIB}/rpc
2>/dev
/null
1967 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1968 chmod +w
${LIB}/$file 2>/dev
/null
1969 chmod a
+r
${LIB}/$file 2>/dev
/null
1971 if [ -r ${LIB}/$file ]; then
1972 if egrep '"C"' ${LIB}/$file >/dev
/null
2>&1; then
1976 echo '#ifdef __cplusplus
1978 #endif' > ${LIB}/${file}.
sed
1979 cat ${LIB}/${file} >> ${LIB}/${file}.
sed
1980 echo '#ifdef __cplusplus
1982 #endif' >> ${LIB}/${file}.
sed
1983 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1984 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1987 # Find any include directives that use "file".
1988 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1989 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1990 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1996 # In limits.h, put #ifndefs around things that are supposed to be defined
1997 # in float.h to avoid redefinition errors if float.h is included first.
1998 # On HP/UX this patch does not work, because on HP/UX limits.h uses
1999 # multi line comments and the inserted #endif winds up inside the
2000 # comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
2001 # we find a #ifndef FLT_MIN we assume that all the required #ifndefs
2002 # are there, and we do not add them ourselves.
2003 # Also fix a nested comment problem in sys/limits.h on Motorola sysV68 R3V7.1
2004 for file in limits.h sys
/limits.h
; do
2005 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2006 mkdir
${LIB}/sys
2>/dev
/null
2007 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2008 chmod +w
${LIB}/$file 2>/dev
/null
2009 chmod a
+r
${LIB}/$file 2>/dev
/null
2012 if [ -r ${LIB}/$file ]; then
2013 if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev
/null
; then
2017 sed -e '/[ ]FLT_MIN[ ]/i\
2020 -e '/[ ]FLT_MIN[ ]/a\
2023 -e '/[ ]FLT_MAX[ ]/i\
2026 -e '/[ ]FLT_MAX[ ]/a\
2029 -e '/[ ]FLT_DIG[ ]/i\
2032 -e '/[ ]FLT_DIG[ ]/a\
2035 -e '/[ ]DBL_MIN[ ]/i\
2038 -e '/[ ]DBL_MIN[ ]/a\
2041 -e '/[ ]DBL_MAX[ ]/i\
2044 -e '/[ ]DBL_MAX[ ]/a\
2047 -e '/[ ]DBL_DIG[ ]/i\
2050 -e '/[ ]DBL_DIG[ ]/a\
2053 -e '/^\(\/\*#define HUGE_VAL 3\.[0-9e+]* *\)\/\*/s//\1/'\
2054 ${LIB}/$file > ${LIB}/${file}.
sed
2055 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2057 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2058 echo Deleting
${LIB}/$file\
; no fixes were needed.
2061 # Find any include directives that use "file".
2062 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2063 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2064 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2070 # In math.h, put #ifndefs around things that might be defined in a gcc
2071 # specific math-*.h file.
2073 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2074 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2075 chmod +w
${LIB}/$file 2>/dev
/null
2076 chmod a
+r
${LIB}/$file 2>/dev
/null
2079 if [ -r ${LIB}/$file ]; then
2081 sed -e '/define[ ]HUGE_VAL[ ]/i\
2084 -e '/define[ ]HUGE_VAL[ ]/a\
2087 ${LIB}/$file > ${LIB}/${file}.
sed
2088 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2090 # In addition, copy the definition of DBL_MAX from float.h
2091 # if math.h requires one. The Lynx math.h requires it.
2092 if egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file >/dev
/null
2>&1; then
2093 if egrep '#define[ ]+DBL_MAX[ ]+' $file >/dev
/null
2>&1; then
2096 dbl_max_def
=`egrep 'define[ ]+DBL_MAX[ ]+.*' float.h 2>/dev/null`
2097 if [ "$dbl_max_def" != "" ]; then
2098 dbl_max_def
=`echo $dbl_max_def | sed 's/.*define[ ]*DBL_MAX[ ]*//'`
2099 sed -e "/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/" \
2100 ${LIB}/$file > ${LIB}/${file}.
sed
2101 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2106 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2107 echo Deleting
${LIB}/$file\
; no fixes were needed.
2110 # Find any include directives that use "file".
2111 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2112 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2113 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2118 # Remove erroneous parentheses in sym.h on Alpha OSF/1.
2120 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2121 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2122 chmod +w
${LIB}/$file 2>/dev
/null
2123 chmod a
+r
${LIB}/$file 2>/dev
/null
2126 if [ -r ${LIB}/$file ]; then
2128 sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
2129 ${LIB}/$file > ${LIB}/${file}.
sed
2130 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2131 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2134 # Find any include directives that use "file".
2135 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2136 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2137 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2142 # Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
2143 # in string.h on sysV68
2144 # Correct the return type for strlen in string.h on Lynx.
2145 # Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
2146 # Add missing const for strdup on OSF/1 V3.0.
2147 # On sysV88 layout is slightly different.
2149 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2150 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2151 chmod +w
${LIB}/$file 2>/dev
/null
2152 chmod a
+r
${LIB}/$file 2>/dev
/null
2155 if [ -r ${LIB}/$file ]; then
2156 echo Fixing
$file, mem
{ccpy
,chr
,cpy
,set} and str
{len
,spn
,cspn
} return value
2157 sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \
2158 -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \
2159 -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
2160 -e '/^extern char$/N' \
2161 -e 's/^extern char\(\n \*memccpy(),\)$/extern void\1/'\
2162 -e '/^ strncmp(),$/N'\
2163 -e 's/^\( strncmp()\),\n\( strlen(),\)$/\1;\
2164 extern unsigned int\
2166 -e '/^extern int$/N'\
2167 -e 's/^extern int\(\n strlen(),\)/extern size_t\1/' \
2168 ${LIB}/$file > ${LIB}/${file}.
sed
2169 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2170 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2173 # Find any include directives that use "file".
2174 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2175 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2176 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2181 # Correct the return type for strlen in strings.h in SunOS 4.
2183 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2184 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2185 chmod +w
${LIB}/$file 2>/dev
/null
2186 chmod a
+r
${LIB}/$file 2>/dev
/null
2189 if [ -r ${LIB}/$file ]; then
2191 sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \
2192 ${LIB}/$file > ${LIB}/${file}.
sed
2193 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2194 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2197 # Find any include directives that use "file".
2198 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2199 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2200 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2205 # Delete the '#define void int' line from curses.h on Lynx
2207 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2208 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2209 chmod +w
${LIB}/$file 2>/dev
/null
2210 chmod a
+r
${LIB}/$file 2>/dev
/null
2213 if [ -r ${LIB}/$file ]; then
2215 sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \
2216 ${LIB}/$file > ${LIB}/${file}.
sed
2217 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2218 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2221 # Find any include directives that use "file".
2222 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2223 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2224 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2229 # Fix `typedef struct term;' on hppa1.1-hp-hpux9.
2231 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2232 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2233 chmod +w
${LIB}/$file 2>/dev
/null
2234 chmod a
+r
${LIB}/$file 2>/dev
/null
2237 if [ -r ${LIB}/$file ]; then
2239 sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \
2240 ${LIB}/$file > ${LIB}/${file}.
sed
2241 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2242 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2245 # Find any include directives that use "file".
2246 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2247 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2248 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2253 # For C++, avoid any typedef or macro definition of bool, and use the
2254 # built in type instead. HP/UX 10.20, at least, also has it
2255 # in curses_colr/curses.h.
2256 for file in curses.h curses_colr
/curses.h
; do
2257 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2258 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2259 chmod +w
${LIB}/$file 2>/dev
/null
2260 chmod a
+r
${LIB}/$file 2>/dev
/null
2262 if [ -r ${LIB}/$file ] && egrep bool
${LIB}/$file >/dev
/null
2>&1; then
2263 echo Fixing
$file, typedef or macro
for bool is invalid
in C
++
2264 sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
2267 -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
2270 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\
2273 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\
2276 ${LIB}/$file > ${LIB}/${file}.
sed
2277 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2278 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2281 # Find any include directives that use "file".
2282 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2283 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2284 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2290 # Fix incorrect S_IF* definitions on m88k-sysv3.
2292 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2293 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2294 chmod +w
${LIB}/$file 2>/dev
/null
2295 chmod a
+r
${LIB}/$file 2>/dev
/null
2298 if [ -r ${LIB}/$file ]; then
2300 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)/' \
2301 -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
2302 ${LIB}/$file > ${LIB}/${file}.
sed
2303 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2304 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2307 # Find any include directives that use "file".
2308 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2309 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2310 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2315 # Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
2316 for file in limits.h sys
/limits.h
; do
2317 if [ $target_canonical = m88k-motorola-sysv3
-o \
2318 $target_canonical = m68k-motorola-sysv
]; then
2320 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2321 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2322 chmod +w
${LIB}/$file 2>/dev
/null
2323 chmod a
+r
${LIB}/$file 2>/dev
/null
2326 if [ -r ${LIB}/$file ]; then
2327 echo "Fixing nested comments in Motorola's $file"
2329 -e 's@^\(#undef[ ][ ]*PIPE_BUF[ ]*/\* max # bytes atomic in write to a\)$@\1 */@' \
2330 -e 's@\(/\*#define HUGE_VAL 3.40282346638528860e+38 \)\(/\*error value returned by Math lib\*/\)$@\1*/ \2@' \
2331 < ${LIB}/$file > ${LIB}/${file}.
sed
2332 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2333 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2340 # Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
2341 for file in stdio.h stdlib.h
; do
2342 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2343 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2344 chmod +w
${LIB}/$file 2>/dev
/null
2345 chmod a
+r
${LIB}/$file 2>/dev
/null
2348 if [ -r ${LIB}/$file ]; then
2349 echo Fixing
$file, getopt declaration
2350 sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
2351 ${LIB}/$file > ${LIB}/${file}.
sed
2352 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2353 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2356 # Find any include directives that use "file".
2357 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2358 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2359 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2365 # Fix __page_size* declarations in pthread.h AIX 4.1.[34].
2366 # The original ones fail if uninitialized externs are not common.
2367 # This is the default for all ANSI standard C++ compilers.
2368 for file in pthread.h
; do
2369 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2370 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2371 chmod +w
${LIB}/$file 2>/dev
/null
2372 chmod a
+r
${LIB}/$file 2>/dev
/null
2375 if [ -r ${LIB}/$file ]; then
2376 echo Fixing
$file, __page_size
* declarations
2377 sed -e 's/^int __page_size/extern int __page_size/' \
2378 ${LIB}/$file > ${LIB}/${file}.
sed
2379 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2380 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2383 # Find any include directives that use "file".
2384 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2385 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2386 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2392 # Determine if we're on Interactive Unix 2.2 or later, in which case we
2393 # need to fix some additional files. This is the same test for ISC that
2395 if test -d /etc
/conf
/kconfig.d \
2396 && grep _POSIX_VERSION
/usr
/include
/sys
/unistd.h
>/dev
/null
2>&1; then
2397 echo "Fixing ISC __STDC__ goof in several files..."
2398 for name
in stdio.h math.h ctype.h sys
/limits.h sys
/fcntl.h sys
/dirent.h
; do
2400 if test -r ${LIB}/$name; then
2405 # On Interactive 2.2, certain traditional Unix definitions
2406 # (notably getc and putc in stdio.h) are omitted if __STDC__ is
2407 # defined, not just if _POSIX_SOURCE is defined. This makes it
2408 # impossible to compile any nontrivial program except with -posix.
2410 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
2411 < $file > ${LIB}/$name.
2412 mv ${LIB}/$name.
${LIB}/$name
2415 echo "Fixing ISC fmod declaration"
2416 # This one's already been fixed for other things.
2418 sed 's/fmod(double)/fmod(double, double)/' <$file >$file.
2421 echo "Fixing nested comments in ISC <sys/limits.h>"
2423 sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file.
2424 sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file.
>${LIB}/$file
2427 # These files in Sun OS 4.x use /**/ to concatenate tokens.
2428 for file in sparc
/asm_linkage.h sun
3/asm_linkage.h sun3x
/asm_linkage.h \
2429 sun
4/asm_linkage.h sun4c
/asm_linkage.h sun4m
/asm_linkage.h \
2430 sun4c
/debug
/asm_linkage.h sun4m
/debug
/asm_linkage.h
;
2432 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2433 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2434 chmod +w
${LIB}/$file 2>/dev
/null
2435 chmod a
+r
${LIB}/$file 2>/dev
/null
2438 if [ -r ${LIB}/$file ]; then
2439 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
2440 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2441 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2444 # Find any include directives that use "file".
2445 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2446 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2447 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2453 # These files in ARM/RISCiX use /**/ to concatenate tokens.
2454 for file in arm
/as_support.h
arm
/mc_type.h
arm
/xcb.h dev
/chardefmac.h \
2455 dev
/ps_irq.h dev
/screen.h dev
/scsi.h sys
/tty.h Xm.acorn
/XmP.h
2457 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2458 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2459 chmod +w
${LIB}/$file 2>/dev
/null
2460 chmod a
+r
${LIB}/$file 2>/dev
/null
2463 if [ -r ${LIB}/$file ]; then
2464 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
2465 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2466 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2469 # Find any include directives that use "file".
2470 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2471 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2472 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2478 # libm.a on m88k-motorola-sysv3 contains a stupid optimization for function
2479 # hypot(), which returns the second argument without even looking at its value
2480 # if the other is 0.0
2481 # Another drawback is that fix-header doesn't fix fabs' prototype, and I have
2484 if [ $target_canonical = m88k-motorola-sysv3
]; then
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
2492 echo Fixing
$file, fabs
/hypot definition
2494 -e 's/extern double floor(), ceil(), fmod(), fabs();/extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/' \
2495 -e '/^extern double hypot();$/a\
2496 \/* Workaround a stupid Motorola optimization if one\
2497 of x or y is 0.0 and the other is negative! *\/\
2499 static __inline__ double fake_hypot (double x, double y)\
2501 static __inline__ double fake_hypot (x, y)\
2505 return fabs (hypot (x, y));\
2507 #define hypot fake_hypot
2509 ${LIB}/$file > ${LIB}/${file}.
sed
2510 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2511 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2517 # math.h on SunOS 4 puts the declaration of matherr before the definition
2518 # of struct exception, so the prototype (added by fixproto) causes havoc.
2520 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2521 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2522 chmod +w
${LIB}/$file 2>/dev
/null
2523 chmod a
+r
${LIB}/$file 2>/dev
/null
2526 if [ -r ${LIB}/$file ]; then
2527 echo Fixing
$file, matherr declaration
2528 sed -e '/^struct exception/,$b' \
2532 ${LIB}/$file > ${LIB}/${file}.
sed
2533 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2534 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2537 # Find any include directives that use "file".
2538 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2539 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2540 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2545 # sys/mman.h on HP/UX is not C++ ready, even though
2546 # NO_IMPLICIT_EXTERN_C is defined on HP/UX.
2547 for file in sys
/mman.h
; do
2548 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2549 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2550 chmod +w
${LIB}/$file 2>/dev
/null
2551 chmod a
+r
${LIB}/$file 2>/dev
/null
2554 if [ -r ${LIB}/$file ]; then
2555 if egrep '"C"' ${LIB}/$file >/dev
/null
2>&1 \
2556 ||
egrep '__BEGIN_DECLS' ${LIB}/$file >/dev
/null
2>&1; then
2560 echo '#ifdef __cplusplus
2562 #endif' > ${LIB}/${file}.
sed
2563 cat ${LIB}/${file} >> ${LIB}/${file}.
sed
2564 echo '#ifdef __cplusplus
2566 #endif' >> ${LIB}/${file}.
sed
2567 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2569 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2572 # Find any include directives that use "file".
2573 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2574 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2575 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2581 # Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
2583 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2584 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2585 chmod +w
${LIB}/$file 2>/dev
/null
2586 chmod a
+r
${LIB}/$file 2>/dev
/null
2589 if [ -r ${LIB}/$file ]; then
2590 echo Fixing
$file, sbrk declaration
2591 sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \
2592 ${LIB}/$file > ${LIB}/${file}.
sed
2593 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2594 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2597 # Find any include directives that use "file".
2598 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2599 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2600 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2605 # Fix <c_asm.h> on Digital UNIX V4.0:
2606 # It contains a prototype for a DEC C internal asm() function, clashing with
2607 # gcc's asm keyword. So protect this with __DECC.
2609 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2610 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2611 chmod +w
${LIB}/$file 2>/dev
/null
2612 chmod a
+r
${LIB}/$file 2>/dev
/null
2615 if [ -r ${LIB}/$file ]; then
2617 sed -e '/^[ ]*float[ ]*fasm/i\
2620 -e '/^[ ]*#[ ]*pragma[ ]*intrinsic([ ]*dasm/a\
2622 ' ${LIB}/$file > ${LIB}/${file}.
sed
2623 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2624 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2627 # Find any include directives that use "file".
2628 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2629 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2630 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2635 # This file on SunOS 4 has a very large macro. When the sed loop
2636 # tries pull it in, it overflows the pattern space size of the SunOS
2637 # sed (GNU sed does not have this problem). Since the file does not
2638 # require fixing, we remove it from the fixed directory.
2639 file=sundev
/ipi_error.h
2640 if [ -r ${LIB}/$file ]; then
2641 echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>"
2645 # Put cpp wrappers around these include files to avoid redeclaration
2646 # errors during multiple inclusion on m88k-tektronix-sysv3.
2647 for file in time.h sys
/time.h
; do
2648 if egrep '#ifndef' $file >/dev
/null
2>&1; then
2651 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2652 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2653 chmod +w
${LIB}/$file 2>/dev
/null
2655 if [ -r ${LIB}/$file ]; then
2656 echo Fixing
$file, to protect against multiple inclusion.
2657 cpp_wrapper
=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
2658 (echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
2659 echo "#define __GCC_GOT_${cpp_wrapper}_"
2661 echo '#endif /* !_GCC_GOT_'${cpp_wrapper}_' */') > ${LIB}/${file}.new
2662 rm -f ${LIB}/$file; mv ${LIB}/${file}.new ${LIB}/$file
2667 # Fix fcntl prototype in fcntl.h on LynxOS.
2669 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2670 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2671 chmod +w
${LIB}/$file 2>/dev
/null
2672 chmod a
+r
${LIB}/$file 2>/dev
/null
2675 if [ -r ${LIB}/$file ]; then
2676 echo Fixing
$file, fcntl declaration
2677 sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
2678 ${LIB}/$file > ${LIB}/${file}.
sed
2679 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2680 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2683 # Find any include directives that use "file".
2684 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2685 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2686 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2691 # Fix definitions of macros used by va-i960.h in VxWorks header file.
2692 file=arch
/i960
/archI960.h
2693 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2694 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2695 chmod +w
${LIB}/$file 2>/dev
/null
2696 chmod a
+r
${LIB}/$file 2>/dev
/null
2699 if [ -r ${LIB}/$file ]; then
2701 sed -e 's/__vsiz/__vxvsiz/' -e 's/__vali/__vxvali/' \
2702 -e s
'/__vpad/__vxvpad/' -e 's/__alignof__/__vxalignof__/' \
2703 ${LIB}/$file > ${LIB}/${file}.
sed
2704 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2705 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2708 # Find any include directives that use "file".
2709 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2710 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2711 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2716 # Make VxWorks header which is almost gcc ready fully gcc ready.
2717 file=types
/vxTypesBase.h
2718 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2719 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2720 chmod +w
${LIB}/$file 2>/dev
/null
2721 chmod a
+r
${LIB}/$file 2>/dev
/null
2724 if [ -r ${LIB}/$file ]; then
2726 sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
2728 #ifndef _GCC_SIZE_T\
2734 -e '/[ ]ptrdiff_t/i\
2735 #ifndef _GCC_PTRDIFF_T\
2736 #define _GCC_PTRDIFF_T
2738 -e '/[ ]ptrdiff_t/a\
2742 #ifndef _GCC_WCHAR_T\
2743 #define _GCC_WCHAR_T
2748 ${LIB}/$file > ${LIB}/${file}.
sed
2749 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2750 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2753 # Find any include directives that use "file".
2754 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2755 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2756 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2761 # Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2763 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2764 mkdir
${LIB}/sys
2>/dev
/null
2765 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2766 chmod +w
${LIB}/$file 2>/dev
/null
2767 chmod a
+r
${LIB}/$file 2>/dev
/null
2770 if [ -r ${LIB}/$file ]; then
2771 if egrep '#include' ${LIB}/$file >/dev
/null
2>&1; then
2774 if egrep 'ULONG' ${LIB}/$file >/dev
/null
2>&1 \
2775 && [ -r types
/vxTypesOld.h
]; then
2777 sed -e '/#define[ ][ ]*__INCstath/a\
2778 #include <types/vxTypesOld.h>
2780 ${LIB}/$file > ${LIB}/${file}.
sed
2781 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2784 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2787 # Find any include directives that use "file".
2788 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2789 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2790 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2795 # Fix VxWorks <time.h> to not require including <vxTypes.h>.
2797 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2798 mkdir
${LIB}/sys
2>/dev
/null
2799 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2800 chmod +w
${LIB}/$file 2>/dev
/null
2801 chmod a
+r
${LIB}/$file 2>/dev
/null
2804 if [ -r ${LIB}/$file ]; then
2805 if egrep 'uint_t[ ][ ]*_clocks_per_sec' ${LIB}/$file >/dev
/null
2>&1; then
2807 sed -e 's/uint_t/unsigned int/' ${LIB}/$file > ${LIB}/${file}.
sed
2808 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2810 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2813 # Find any include directives that use "file".
2814 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2815 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2816 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2821 # Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
2823 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2824 mkdir
${LIB}/sys
2>/dev
/null
2825 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2826 chmod +w
${LIB}/$file 2>/dev
/null
2827 chmod a
+r
${LIB}/$file 2>/dev
/null
2830 if [ -r ${LIB}/$file ]; then
2831 if egrep '^extern struct sigevent;' ${LIB}/$file >/dev
/null
2>&1; then
2833 sed -e 's/^extern struct sigevent;/struct sigevent;/' ${LIB}/$file > ${LIB}/${file}.
sed
2834 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2836 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2839 # Find any include directives that use "file".
2840 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2841 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2842 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2847 # Another bad dependency in VxWorks 5.2 <time.h>.
2849 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2850 mkdir
${LIB}/sys
2>/dev
/null
2851 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2852 chmod +w
${LIB}/$file 2>/dev
/null
2853 chmod a
+r
${LIB}/$file 2>/dev
/null
2856 if [ -r ${LIB}/$file ]; then
2857 if egrep VOIDFUNCPTR
${LIB}/$file >/dev
/null
2>&1; then
2858 if [ -r vxWorks.h
]; then
2860 sed -e '/VOIDFUNCPTR/i\
2861 #ifndef __gcc_VOIDFUNCPTR_defined\
2863 typedef void (*__gcc_VOIDFUNCPTR) (...);\
2865 typedef void (*__gcc_VOIDFUNCPTR) ();\
2867 #define __gcc_VOIDFUNCPTR_defined\
2870 -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \
2871 ${LIB}/$file > ${LIB}/${file}.
sed
2872 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2875 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2878 # Find any include directives that use "file".
2879 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2880 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2881 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2886 # This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89; gcc
2887 # doesn't understand it.
2889 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2890 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2891 chmod +w
${LIB}/$file 2>/dev
/null
2892 chmod a
+r
${LIB}/$file 2>/dev
/null
2895 if [ -r ${LIB}/$file ]; then
2896 echo "Fixing __asm directive in sys/param.h"
2897 sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \
2898 ${LIB}/$file > ${LIB}/${file}.
sed
2899 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2900 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2903 # Find any include directives that use "file".
2904 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2905 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2906 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2911 # signal.h on SunOS defines signal using (), which causes trouble when
2912 # compiling with g++ -pedantic.
2913 for file in signal.h sys
/signal.h
; do
2914 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2915 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2916 chmod +w
${LIB}/$file 2>/dev
/null
2917 chmod a
+r
${LIB}/$file 2>/dev
/null
2920 if [ -r ${LIB}/$file ]; then
2921 echo "Checking for bad C++ prototype in $file"
2922 sed -e '/^void (\*signal())();$/i\
2924 void (*signal(...))(...);\
2927 -e '/^void (\*signal())();$/a\
2930 ${LIB}/$file > ${LIB}/${file}.
sed
2931 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2932 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2935 # Find any include directives that use "file".
2936 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2937 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2938 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2944 # sys/signal.h on some versions of AIX uses volatile in the typedef of
2945 # sig_atomic_t, which causes gcc to generate a warning about duplicate
2946 # volatile when a sig_atomic_t variable is declared volatile, as
2947 # required by ANSI C.
2949 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2950 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2951 chmod +w
${LIB}/$file 2>/dev
/null
2952 chmod a
+r
${LIB}/$file 2>/dev
/null
2955 if [ -r ${LIB}/$file ]; then
2956 echo "Checking for duplicate volatile in sys/signal.h"
2957 sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' \
2958 ${LIB}/$file > ${LIB}/${file}.
sed
2959 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2960 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2963 # Find any include directives that use "file".
2964 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2965 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2966 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2971 # Some math.h files define struct exception, which conflicts with
2972 # the class exception defined in the C++ file std/stdexcept.h. We
2973 # redefine it to __math_exception. This is not a great fix, but I
2974 # haven't been able to think of anything better.
2976 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2977 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2978 chmod +w
${LIB}/$file 2>/dev
/null
2979 chmod a
+r
${LIB}/$file 2>/dev
/null
2982 if [ -r ${LIB}/$file ]; then
2983 echo Fixing
$file, exception
2984 sed -e '/struct exception/i\
2986 #define exception __math_exception\
2989 -e '/struct exception/a\
2993 ' ${LIB}/$file > ${LIB}/${file}.
sed
2994 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2995 if egrep 'matherr()' ${LIB}/$file >/dev
/null
2>&1; then
2998 #define exception __math_exception\
3005 ' ${LIB}/$file > ${LIB}/${file}.
sed
3006 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
3008 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
3011 # Find any include directives that use "file".
3012 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
3013 dir
=`echo $file | sed -e s'|/[^/]*$||'`
3014 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
3019 # rpc/auth.h on SunOS needs prototypes for its AUTH->auth_ops function pointers
3021 # rpc/clnt.h CLIENT->clnt_ops
3022 # rpc/svc.h SVCXPRT->xp_ops
3023 # rpc/xdr.h XDR->xdr_ops
3024 for file in rpc
/auth.h rpc
/clnt.h rpc
/svc.h rpc
/xdr.h
; do
3025 # each file has a different name to replace, so if you add a file to
3026 # that list please update the following case statement.
3041 # Oh Oh, we shouldn't be here
3046 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
3047 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
3048 chmod +w
${LIB}/$file 2>/dev
/null
3049 chmod a
+r
${LIB}/$file 2>/dev
/null
3052 if [ -r ${LIB}/$file ]; then
3053 echo "Checking for needed C++ prototype in $file"
3054 sed -e 's/^\(.*\)\*\('$prefix'.*\)();\(.*\)/\
3060 $LIB/$file > ${LIB}/${file}.
sed
3062 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
3063 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
3066 # Find any include directives that use "file".
3067 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
3068 dir
=`echo $file | sed -e s'|/[^/]*$||'`
3069 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
3075 # sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
3076 # defining regex.h types. This causes C++ library build and usage failures.
3077 # Fixing this correctly requires checking and modifying 3 files.
3078 for file in reg_types.h regex.h sys
/lc_core.h
; do
3079 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
3080 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
3081 chmod +w
${LIB}/$file 2>/dev
/null
3082 chmod a
+r
${LIB}/$file 2>/dev
/null
3085 if [ -r ${LIB}/reg_types.h
]; then
3086 if egrep '} regex_t;' ${LIB}/reg_types.h
>/dev
/null
2>&1; then
3087 if [ -r ${LIB}/sys
/lc_core.h
]; then
3088 if egrep ' regex_t ' ${LIB}/sys
/lc_core.h
>/dev
/null
2>&1; then
3089 if [ -r ${LIB}/regex.h
]; then
3090 if egrep '__regex_t' ${LIB}/regex.h
>/dev
/null
2>&1; then
3093 echo Fixing reg_types.h
, regex.h
, sys
/lc_core.h
3094 for file in reg_types.h sys
/lc_core.h
; do
3095 sed -e 's/regex_t/__regex_t/g' \
3096 -e 's/regoff_t/__regoff_t/g' \
3097 -e 's/regmatch_t/__regmatch_t/g' \
3098 ${LIB}/$file > ${LIB}/${file}.
sed
3099 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
3101 sed -e '/#include <reg_types.h>/a\
3102 typedef __regex_t regex_t;\
3103 typedef __regoff_t regoff_t;\
3104 typedef __regmatch_t regmatch_t;\
3106 ${LIB}/regex.h
> ${LIB}/regex.h.
sed
3107 rm -f ${LIB}/regex.h; mv ${LIB}/regex.h.sed ${LIB}/regex.h
3114 for file in reg_types.h regex.h sys
/lc_core.h
; do
3115 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
3118 # Find any include directives that use "file".
3119 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
3120 dir
=`echo $file | sed -e s'|/[^/]*$||'`
3121 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
3126 # AIX headers define NULL to be cast to a void pointer, which is illegal
3128 for file in curses.h dbm.h locale.h stdio.h stdlib.h string.h
time.h unistd.h sys
/dir.h sys
/param.h sys
/types.h
; do
3129 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
3130 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
3131 chmod +w
${LIB}/$file 2>/dev
/null
3132 chmod a
+r
${LIB}/$file 2>/dev
/null
3135 if [ -r ${LIB}/$file ]; then
3136 if egrep '#.*define.*NULL.*void' ${LIB}/$file >/dev
/null
2>&1; then
3137 echo "Fixing $file, bad NULL macro"
3138 sed -e 's/^#[ ]*define[ ]*NULL[ ]*((void[ ]*\*)0)/#define NULL 0/' \
3139 ${LIB}/$file > ${LIB}/${file}.
sed
3140 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
3141 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
3144 # Find any include directives that use "file".
3145 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
3146 dir
=`echo $file | sed -e s'|/[^/]*$||'`
3147 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
3154 # HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
3156 base
=`basename $file`
3157 if [ -r ${LIB}/$file ]; then
3158 file_to_fix
=${LIB}/$file
3160 if [ -r ${INPUT}/$file ]; then
3161 file_to_fix
=${INPUT}/$file
3166 if [ \
! -z "$file_to_fix" ]; then
3167 echo Checking
$file_to_fix
3168 sed -e '/^#[ ]*define[ ]*MAXINT[ ]/i\
3171 -e '/^#[ ]*define[ ]*MAXINT[ ]/a\
3173 ' $file_to_fix > /tmp
/$base
3174 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
3177 echo Fixed
$file_to_fix
3179 cp /tmp
/$base ${LIB}/$file
3180 chmod a
+r
${LIB}/$file
3181 # Find any include directives that use "file".
3182 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
3183 dir
=`echo $file | sed -e s'|/[^/]*$||'`
3184 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
3191 # This loop does not appear to do anything, because it uses file
3192 # rather than $file when setting target. It also appears to be
3193 # unnecessary, since the main loop processes symbolic links.
3195 # echo 'Making internal symbolic non-directory links'
3197 # files=`find . -type l -print`
3198 # for file in $files; do
3199 # dest=`ls -ld $file | sed -n 's/.*-> //p'`
3200 # if expr "$dest" : '[^/].*' > /dev/null; then
3201 # target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
3202 # if [ -f $target ]; then
3203 # ln -s $dest ${LIB}/$file >/dev/null 2>&1
3209 # Make sure that any include files referenced using double quotes
3210 # exist in the fixed directory. This comes last since otherwise
3211 # we might end up deleting some of these files "because they don't
3215 while [ $# != 0 ]; do
3217 while [ $# != 0 ]; do
3218 # $1 is the directory to copy from, $2 is the unfixed file,
3219 # $3 is the fixed file name.
3222 if [ -r $2 ] && [ ! -r $3 ]; then
3223 cp $2 $3 >/dev
/null
2>&1 ||
echo "Can't copy $2"
3224 chmod +w
$3 2>/dev
/null
3225 chmod a
+r
$3 2>/dev
/null
3227 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
3228 dir
=`echo $2 | sed -e s'|/[^/]*$||'`
3229 dir2
=`echo $3 | sed -e s'|/[^/]*$||'`
3230 newreq
="$newreq $1 $dir/$include $dir2/$include"
3239 echo 'Cleaning up DONE files.'
3241 find .
-name DONE
-exec rm -f '{}' ';'
3243 echo 'Removing unneeded directories:'
3245 files
=`find . -type d \! -name '.' -print | sort -r`
3246 for file in $files; do
3247 rmdir $LIB/$file > /dev
/null
2>&1
3250 # # # # # # # # # # # # # # # # # # # # #
3252 # End of for INPUT directories
3256 # # # # # # # # # # # # # # # # # # # # #
3259 rm -f include
/assert.h
3260 cp ${srcdir}/assert.h include
/assert.h ||
exit 1
3261 chmod a
+r include
/assert.h