2 # Install modified versions of certain ANSI-incompatible system header files
3 # which are fixed to work correctly with ANSI C
4 # and placed in a directory that GNU C will search.
6 # See README-fixinc for more information.
8 # Directory containing the original header files.
9 # (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
10 INPUT
=${2-${INPUT-/usr/include}}
12 # Directory in which to store the results.
13 LIB
=${1?"fixincludes: output directory not specified"}
15 # Define what target system we're fixing.
16 if test -r .
/Makefile
; then
17 target_canonical
="`sed -n -e 's,^target[ ]*=[ ]*\(.*\)$,\1,p' < Makefile`"
18 test -z "${target_canonical}" && target_canonical
=unknown
20 target_canonical
=unknown
23 # Define PWDCMD as a command to use to get the working dir
24 # in the form that we want.
28 # On an Apollo, discard everything before `/usr'.
29 PWDCMD
="eval pwd | sed -e 's,.*/usr/,/usr/,'"
36 # Make sure it exists.
37 if [ ! -d $LIB ]; then
41 # Make LIB absolute only if needed to avoid problems with the amd.
46 cd $LIB; LIB
=`${PWDCMD}`
50 # Fail if no arg to specify a directory for the output.
52 then echo fixincludes
: no output directory specified
56 echo Building fixed headers
in ${LIB}
58 # Determine whether this system has symbolic links.
59 if ln -s X
$LIB/ShouldNotExist
2>/dev
/null
; then
60 rm -f $LIB/ShouldNotExist
62 elif ln -s X
/tmp
/ShouldNotExist
2>/dev
/null
; then
63 rm -f /tmp
/ShouldNotExist
69 echo Finding directories and links to directories
71 # Find all directories and all symlinks that point to directories.
72 # Put the list in $files.
73 # Each time we find a symlink, add it to newdirs
74 # so that we do another find within the dir the link points to.
75 # Note that $files may have duplicates in it;
76 # later parts of this file are supposed to ignore them.
79 while [ -n "$dirs" ] && [ $levels -gt 0 ]
81 levels
=`expr $levels - 1`
85 echo " Searching $INPUT/$d"
87 # Find all directories under $d, relative to $d, excluding $d itself.
88 # (The /. is needed after $d in case $d is a symlink.)
89 files
="$files `find $d/. -type d -print | \
90 sed -e '/\/\.$/d' -e 's@/./@/@g'`"
91 # Find all links to directories.
92 # Using `-exec test -d' in find fails on some systems,
93 # and trying to run test via sh fails on others,
94 # so this is the simplest alternative left.
95 # First find all the links, then test each one.
98 theselinks
=`find $d/. -type l -print | sed -e 's@/./@/@g'`
99 for d1
in $theselinks --dummy--
101 # If the link points to a directory,
102 # add that dir to $newdirs
106 if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
108 newdirs
="$newdirs $d1"
118 echo "All directories (including links to directories):"
121 for file in $files; do
123 if [ ! -d $LIB/$file ]
124 then mkdir
$LIB/$file
129 # treetops gets an alternating list
130 # of old directories to copy
131 # and the new directories to copy to.
132 treetops
="${INPUT} ${LIB}"
135 echo 'Making symbolic directory links'
136 for file in $files; do
137 dest
=`ls -ld $file | sed -n 's/.*-> //p'`
140 # In case $dest is relative, get to $file's dir first.
142 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
143 # Check that the target directory exists.
144 # Redirections changed to avoid bug in sh on Ultrix.
145 (cd $dest) > /dev
/null
2>&1
148 # X gets the dir that the link actually leads to.
150 # Canonicalize ${INPUT} now to minimize the time an
151 # automounter has to change the result of ${PWDCMD}.
152 cinput
=`cd ${INPUT}; ${PWDCMD}`
153 # If a link points to ., make a similar link to .
154 if [ $x = ${cinput} ]; then
155 echo $file '->' .
': Making link'
156 rm -fr ${LIB}/$file > /dev
/null
2>&1
157 ln -s .
${LIB}/$file > /dev
/null
2>&1
158 # If link leads back into ${INPUT},
159 # make a similar link here.
160 elif expr $x : "${cinput}/.*" > /dev
/null
; then
161 # Y gets the actual target dir name, relative to ${INPUT}.
162 y
=`echo $x | sed -n "s&${cinput}/&&p"`
163 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
165 sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
166 echo $file '->' $dots$y ': Making link'
167 rm -fr ${LIB}/$file > /dev
/null
2>&1
168 ln -s $dots$y ${LIB}/$file > /dev
/null
2>&1
170 # If the link is to a dir $target outside ${INPUT},
171 # repoint the link at ${INPUT}/root$target
172 # and process $target into ${INPUT}/root$target
173 # treat this directory as if it actually contained the files.
174 echo $file '->' root
$x ': Making link'
175 if [ -d $LIB/root
$x ]
181 while [ x
$dirname != x
]; do
182 component
=`echo $dirname | sed -e 's|/.*$||'`
183 mkdir
$component >/dev
/null
2>&1
185 dirmade
=$dirmade/$component
186 dirname=`echo $dirname | sed -e 's|[^/]*/||'`
189 # Duplicate directory structure created in ${LIB}/$file in new
191 for file2
in $files; do
194 dupdir
=${LIB}/root
$x/`echo $file2 | sed -n "s|^${file}/||p"`
195 echo "Duplicating ${file}'s ${dupdir}"
206 # Get the path from ${LIB} to $file, accounting for symlinks.
207 parent
=`echo "$file" | sed -e 's@/[^/]*$@@'`
208 libabs
=`cd ${LIB}; ${PWDCMD}`
209 file2
=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
210 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
211 dots
=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
212 rm -fr ${LIB}/$file > /dev
/null
2>&1
213 ln -s ${dots}root
$x ${LIB}/$file > /dev
/null
2>&1
214 treetops
="$treetops $x ${LIB}/root$x"
225 while [ $# != 0 ]; do
226 # $1 is an old directory to copy, and $2 is the new directory to copy to.
229 # The same dir can appear more than once in treetops.
230 # There's no need to scan it more than once.
236 echo Fixing directory
$1 into
$2
237 # Check .h files which are symlinks as well as those which are files.
238 # A link to a header file will not be processed by anything but this.
240 files
=`find . -name '*.h' \( -type f -o -type l \) -print`
242 files
=`find . -name '*.h' -type f -print`
244 echo Checking header files
246 # Note that BSD43_* are used on recent MIPS systems.
247 for file in $files; do
248 # This call to egrep is essential, since checking a file with egrep
249 # is much faster than actually trying to fix it.
250 # It is also essential that most files *not* match!
251 # Thus, matching every #endif is unacceptable.
252 # But the argument to egrep must be kept small, or many versions of egrep
253 # won't be able to handle it.
255 # We use the pattern [!-.0-z{|}~] instead of [^/ ] to match a noncomment
256 # following #else or #endif because some buggy egreps think [^/] matches
257 # newline, and they thus think `#else ' matches `#e[ndiflse]*[ ]+[^/ ]'.
258 # [!-.0-~] does not work properly on AIX 4.1.
260 # We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
261 # following #if or #elif that is not surrounded by __. The `a-ce-km-z'
262 # in this pattern lacks `d' and `l'; this means we don't worry about
263 # identifiers starting with `d' or `l'. This is OK, since none of the
264 # identifiers below start with `d' or `l'. It also greatly improves
265 # performance, since many files contain lines of the form `#if ... defined ...'
267 if egrep '//|[ _]_IO|CTRL|^#define.NULL|^#e[nl][ds][ief]*[ ]+[!-.0-z\{\|\}\~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-zA-Z][a-zA-Z0-9]' $file >/dev
/null
; then
268 if [ -r $file ]; then
269 cp $file $2/$file >/dev
/null
2>&1 \
270 ||
echo "Can't copy $file"
273 # The fixinc_eol stuff is to work around a bug in the sed
274 # program on HP/UX 10.20.
275 # Here is how the sed commands in braces work.
276 # (It doesn't work to put the comments inside the sed commands.)
277 # Surround each word with spaces, to simplify matching below.
278 # ANSIfy each pre-ANSI machine-dependent symbol
279 # by surrounding it with __ __.
280 # Remove the spaces that we inserted around each word.
284 s/\\$/\\*fixinc_eol*/
286 s/\\\*fixinc_eol\*/\\/g
287 s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
288 s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%
289 s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
290 s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
291 s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%
292 /\/\/[^*]/ s|//\(.*\)$|/*\1*/|
294 /[ ]_IO[A-Z]*[ ]*(/ s/\(_IO[A-Z]*[ ]*(\)\(.\),/\1'\''\2'\'',/
295 /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
296 /#[ ]*define[ ]*[ ]_IO/ s/'\''\([cgxtf]\)'\''/\1/g
297 /#[ ]*define[ ]*[ ]BSD43__IO/ s/'\''\([cgx]\)'\''/\1/g
298 /#[ ]*define[ ]*[ ]DESIOC/ s/'\''\([cdgx]\)'\''/\1/g
299 /[^A-Z0-9_]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
300 /[^A-Z0-9]_CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
301 /#[ ]*define[ ]*[ ]CTRL/ s/'\''\([cgx]\)'\''/\1/g
302 /#[ ]*define[ ]*[ ]_CTRL/ s/'\''\([cgx]\)'\''/\1/g
303 /#[ ]*define.BSD43_CTRL/ s/'\''\([cgx]\)'\''/\1/g
305 s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
307 s/ bsd4\([0-9]\) / __bsd4\1__ /g
308 s/ _*host_mips / __host_mips__ /g
309 s/ _*i386 / __i386__ /g
311 s/ is68k / __is68k__ /g
312 s/ m68k / __m68k__ /g
313 s/ mc680\([0-9]\)0 / __mc680\10__ /g
314 s/ m88k / __m88k__ /g
315 s/ _*mips / __mips__ /g
316 s/ news\([0-9]*\) / __news\1__ /g
317 s/ ns32000 / __ns32000__ /g
318 s/ pdp11 / __pdp11__ /g
321 s/ sony_news / __sony_news__ /g
322 s/ sparc / __sparc__ /g
323 s/ sun\([a-z0-9]*\) / __sun\1__ /g
324 s/ tahoe / __tahoe__ /g
325 s/ tower\([_0-9]*\) / __tower\1__ /g
326 s/ u370 / __u370__ /g
327 s/ u3b\([0-9]*\) / __u3b\1__ /g
328 s/ unix / __unix__ /g
330 s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
331 s/ _*\([Rr][34]\)000 / __\1000__ /g
332 s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
334 s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
336 /^#define.NULL[ ]/ i\
338 ' $2/$file > $2/$file.
339 mv $2/$file.
$2/$file
340 if cmp $file $2/$file >/dev
/null
2>&1 \
341 ||
egrep 'This file is part of the GNU C Library' $2/$file >/dev
/null
2>&1; then
345 # Find any include directives that use "file".
346 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $2/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
347 dir
=`echo $file | sed -e s'|/[^/]*$||'`
348 required
="$required $1 $dir/$include $2/$dir/$include"
359 # Install the proper definition of the three standard types in header files
360 # that they come from.
361 for file in sys
/types.h stdlib.h sys
/stdtypes.h stddef.h memory.h unistd.h
; do
362 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
363 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
364 chmod +w
${LIB}/$file 2>/dev
/null
365 chmod a
+r
${LIB}/$file 2>/dev
/null
368 if [ -r ${LIB}/$file ]; then
369 echo Fixing size_t
, ptrdiff_t and wchar_t
in $file
371 -e '/^[ ]*\*[ ]*typedef unsigned int size_t;/N' \
372 -e 's/^\([ ]*\*[ ]*typedef unsigned int size_t;\n[ ]*\*\/\)/\1\
373 #ifndef __SIZE_TYPE__\
374 #define __SIZE_TYPE__ long unsigned int\
376 typedef __SIZE_TYPE__ size_t;\
378 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
379 #ifndef __SIZE_TYPE__\
380 #define __SIZE_TYPE__ long unsigned int\
383 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
384 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
385 #ifndef __PTRDIFF_TYPE__\
386 #define __PTRDIFF_TYPE__ long int\
389 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
390 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
391 #ifndef __WCHAR_TYPE__\
392 #define __WCHAR_TYPE__ int\
396 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\
399 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
400 ${LIB}/$file > ${LIB}/${file}.
sed
401 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
402 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
405 # Find any include directives that use "file".
406 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
407 dir
=`echo $file | sed -e s'|/[^/]*$||'`
408 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
414 # Fix #defines under Alpha OSF/1:
415 # The following files contain '#pragma extern_prefix "_FOO"' followed by
416 # a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
417 # statements is to reduce namespace pollution. While these macros work
418 # properly in most cases, they don't allow you to take a pointer to the
419 # "something" being modified. To get around this limitation, change these
420 # statements to be of the form '#define something _FOOsomething'.
421 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
423 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
424 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
425 chmod +w
${LIB}/$file 2>/dev
/null
426 chmod a
+r
${LIB}/$file 2>/dev
/null
429 if [ -r ${LIB}/$file ]; then
430 echo Fixing
$file extern_prefix
431 sed -e 's/^[ ]*#[ ]*define[ ]*\([^(]*\)\(([^)]*)\)[ ]*\(_.\)\1\2[ ]*$/#define \1 \3\1/' ${LIB}/$file > ${LIB}/${file}.
sed
432 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
433 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
436 # Find any include directives that use "file".
437 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
438 dir
=`echo $file | sed -e s'|/[^/]*$||'`
439 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
445 # Fix one other error in this file: a mismatched quote not inside a C comment.
446 file=sundev
/vuid_event.h
447 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
448 mkdir
${LIB}/sundev
2>/dev
/null
449 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
450 chmod +w
${LIB}/$file 2>/dev
/null
451 chmod a
+r
${LIB}/$file 2>/dev
/null
454 if [ -r ${LIB}/$file ]; then
455 echo Fixing
$file comment
456 sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.
sed
457 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
458 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
461 # Find any include directives that use "file".
462 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
463 dir
=`echo $file | sed -e s'|/[^/]*$||'`
464 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
469 # Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
470 file=sunwindow
/win_cursor.h
471 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
472 # mkdir ${LIB}/sunwindow 2>/dev/null
473 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
474 chmod +w
${LIB}/$file 2>/dev
/null
476 if [ -r ${LIB}/$file ]; then
478 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
479 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
480 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
483 # Find any include directives that use "file".
484 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
485 dir
=`echo $file | sed -e s'|/[^/]*$||'`
486 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
490 file=sunwindow
/win_lock.h
491 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
492 # mkdir ${LIB}/sunwindow 2>/dev/null
493 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
494 chmod +w
${LIB}/$file 2>/dev
/null
496 if [ -r ${LIB}/$file ]; then
498 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
499 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
500 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
503 # Find any include directives that use "file".
504 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
505 dir
=`echo $file | sed -e s'|/[^/]*$||'`
506 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
511 # Fix this Sun file to avoid interfering with stddef.h.
513 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
514 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
515 chmod +w
${LIB}/$file 2>/dev
/null
516 chmod a
+r
${LIB}/$file 2>/dev
/null
519 if [ -r ${LIB}/$file ]; then
521 sed -e '/[ ]size_t.*;/i\
528 -e '/[ ]ptrdiff_t.*;/i\
529 #ifndef _GCC_PTRDIFF_T\
530 #define _GCC_PTRDIFF_T
532 -e '/[ ]ptrdiff_t.*;/a\
535 -e '/[ ]wchar_t.*;/i\
536 #ifndef _GCC_WCHAR_T\
539 -e '/[ ]wchar_t.*;/a\
541 ' ${LIB}/$file > ${LIB}/${file}.
sed
542 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
543 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
546 # Find any include directives that use "file".
547 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
548 dir
=`echo $file | sed -e s'|/[^/]*$||'`
549 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
554 # Fix this ARM/RISCiX file to avoid interfering with the use of __wchar_t
557 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
558 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
559 chmod +w
${LIB}/$file 2>/dev
/null
560 chmod a
+r
${LIB}/$file 2>/dev
/null
563 if [ -r ${LIB}/$file ]; then
565 sed -e "s/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
566 -e "s/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
567 ${LIB}/$file > ${LIB}/${file}.
sed
568 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
569 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
572 # Find any include directives that use "file".
573 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
574 dir
=`echo $file | sed -e s'|/[^/]*$||'`
575 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
580 # Fix this ARM/RISCiX file where ___type is a Compiler hint that is specific to
581 # the Norcroft compiler.
583 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
584 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
585 chmod +w
${LIB}/$file 2>/dev
/null
586 chmod a
+r
${LIB}/$file 2>/dev
/null
589 if [ -r ${LIB}/$file ]; then
591 sed -e "s/___type p_type/p_type/" \
592 ${LIB}/$file > ${LIB}/${file}.
sed
593 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
594 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
597 # Find any include directives that use "file".
598 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
599 dir
=`echo $file | sed -e s'|/[^/]*$||'`
600 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
605 # Fix this file to avoid interfering with stddef.h, but don't mistakenly
606 # match ssize_t present in AIX for the ps/2, or typedefs which use (but do not
609 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
610 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
611 chmod +w
${LIB}/$file 2>/dev
/null
612 chmod a
+r
${LIB}/$file 2>/dev
/null
615 if [ -r ${LIB}/$file ]; then
617 sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
621 -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
623 ' ${LIB}/$file > ${LIB}/${file}.
sed
624 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
625 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
628 # Find any include directives that use "file".
629 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
630 dir
=`echo $file | sed -e s'|/[^/]*$||'`
631 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
636 # Fix HP's use of ../machine/inline.h to refer to
637 # /usr/include/machine/inline.h
639 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
640 cp $file ${LIB}/$file
642 if [ -r ${LIB}/$file ] ; then
644 sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
645 -e 's,"../machine/psl.h",<machine/psl.h>,' \
646 ${LIB}/$file > ${LIB}/${file}.
sed
647 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
648 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
651 # Find any include directives that use "file".
652 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
653 dir
=`echo $file | sed -e s'|/[^/]*$||'`
654 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
659 # Fix an error in this file: the #if says _cplusplus, not the double
660 # underscore __cplusplus that it should be
662 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
663 mkdir
${LIB}/rpcsvc
2>/dev
/null
664 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
665 chmod +w
${LIB}/$file 2>/dev
/null
666 chmod a
+r
${LIB}/$file 2>/dev
/null
669 if [ -r ${LIB}/$file ]; then
670 echo Fixing
$file, __cplusplus macro
671 sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.
sed
672 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
673 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
676 # Find any include directives that use "file".
677 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
678 dir
=`echo $file | sed -e s'|/[^/]*$||'`
679 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
684 # Fix an error in this file: a missing semi-colon at the end of the statsswtch
685 # structure definition.
687 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
688 mkdir
${LIB}/rpcsvc
2>/dev
/null
689 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
690 chmod +w
${LIB}/$file 2>/dev
/null
691 chmod a
+r
${LIB}/$file 2>/dev
/null
694 if [ -r ${LIB}/$file ]; then
695 echo Fixing
$file, definition of statsswtch
696 sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.
sed
697 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
698 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
701 # Find any include directives that use "file".
702 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
703 dir
=`echo $file | sed -e s'|/[^/]*$||'`
704 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
709 # Fix an error in this file: a missing semi-colon at the end of the nodeent
710 # structure definition.
711 file=netdnet
/dnetdb.h
712 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
713 mkdir
${LIB}/netdnet
2>/dev
/null
714 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
715 chmod +w
${LIB}/$file 2>/dev
/null
716 chmod a
+r
${LIB}/$file 2>/dev
/null
719 if [ -r ${LIB}/$file ]; then
720 echo Fixing
$file, definition of nodeent
721 sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.
sed
722 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
723 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
726 # Find any include directives that use "file".
727 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
728 dir
=`echo $file | sed -e s'|/[^/]*$||'`
729 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
734 # Check for bad #ifdef line (in Ultrix 4.1)
736 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
737 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
738 chmod +w
${LIB}/$file 2>/dev
/null
739 chmod a
+r
${LIB}/$file 2>/dev
/null
742 if [ -r ${LIB}/$file ]; then
743 echo Fixing
$file, bad \
#ifdef line
744 sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.
sed
745 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
746 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
749 # Find any include directives that use "file".
750 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
751 dir
=`echo $file | sed -e s'|/[^/]*$||'`
752 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
757 # Check for (...) in C++ code in HP/UX sys/file.h.
759 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
760 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
761 chmod +w
${LIB}/$file 2>/dev
/null
762 chmod a
+r
${LIB}/$file 2>/dev
/null
765 if [ -r ${LIB}/$file ]; then
766 if egrep HPUX_SOURCE
${LIB}/$file > /dev
/null
; then
767 echo Fixing
$file, use of
'(...)'
768 sed -e 's/(\.\.\.)/(struct file * ...)/' ${LIB}/$file > ${LIB}/${file}.
sed
769 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
770 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
773 # Find any include directives that use "file".
774 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
775 dir
=`echo $file | sed -e s'|/[^/]*$||'`
776 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
782 # Check for superfluous `static' (in Ultrix 4.2)
783 # On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
785 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
786 mkdir
${LIB}/machine
2>/dev
/null
787 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
788 chmod +w
${LIB}/$file 2>/dev
/null
789 chmod a
+r
${LIB}/$file 2>/dev
/null
792 if [ -r ${LIB}/$file ]; then
793 echo Fixing
$file, superfluous static and broken includes of other files.
794 sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
795 -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
796 -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
797 ${LIB}/$file > ${LIB}/${file}.
sed
798 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
799 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
802 # Find any include directives that use "file".
803 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
804 dir
=`echo $file | sed -e s'|/[^/]*$||'`
805 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
807 # This file has an alternative name, mips/cpu.h. Fix that name, too.
808 if cmp machine
/cpu.h mips
/cpu.h
> /dev
/null
2>&1; then
809 mkdir
${LIB}/mips
2>&-
810 # Don't remove the file first, they may be the same file!
811 ln ${LIB}/$file ${LIB}/mips
/cpu.h
> /dev
/null
2>&1
816 # Incorrect sprintf declaration in X11/Xmu.h
818 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
819 mkdir
${LIB}/X11
2>/dev
/null
820 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
821 chmod +w
${LIB}/$file 2>/dev
/null
822 chmod a
+r
${LIB}/$file 2>/dev
/null
825 if [ -r ${LIB}/$file ]; then
826 echo Fixing
$file sprintf declaration
827 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
828 extern char * sprintf();\
829 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
830 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
831 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
834 # Find any include directives that use "file".
835 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
836 dir
=`echo $file | sed -e s'|/[^/]*$||'`
837 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
842 # Incorrect sprintf declaration in X11/Xmu/Xmu.h
843 # (It's not clear whether the right file name is this or X11/Xmu.h.)
845 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
846 mkdir
${LIB}/X11
/Xmu
2>/dev
/null
847 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
848 chmod +w
${LIB}/$file 2>/dev
/null
849 chmod a
+r
${LIB}/$file 2>/dev
/null
852 if [ -r ${LIB}/$file ]; then
853 echo Fixing
$file sprintf declaration
854 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
855 extern char * sprintf();\
856 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
857 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
858 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
861 # Find any include directives that use "file".
862 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
863 dir
=`echo $file | sed -e s'|/[^/]*$||'`
864 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
869 # Check for missing ';' in struct
871 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
872 mkdir
${LIB}/netinet
2>/dev
/null
873 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
874 chmod +w
${LIB}/$file 2>/dev
/null
875 chmod a
+r
${LIB}/$file 2>/dev
/null
878 if [ -r ${LIB}/$file ]; then
880 sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.
sed
881 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
882 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
885 # Find any include directives that use "file".
886 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
887 dir
=`echo $file | sed -e s'|/[^/]*$||'`
888 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
893 # Fix the CAT macro in SunOS memvar.h.
894 file=pixrect
/memvar.h
895 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
896 mkdir
${LIB}/pixrect
2>/dev
/null
897 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
898 chmod +w
${LIB}/$file 2>/dev
/null
899 chmod a
+r
${LIB}/$file 2>/dev
/null
902 if [ -r ${LIB}/$file ]; then
904 sed -e '/^#define.CAT(a,b)/ i\
906 #define CAT(a,b) a##b\
908 /^#define.CAT(a,b)/ a\
910 ' ${LIB}/$file > ${LIB}/${file}.
sed
911 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
912 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
915 # Find any include directives that use "file".
916 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
917 dir
=`echo $file | sed -e s'|/[^/]*$||'`
918 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
923 # Check for yet more missing ';' in struct (in SunOS 4.0.x)
925 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
926 mkdir
${LIB}/rpcsvc
2>/dev
/null
927 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
928 chmod +w
${LIB}/$file 2>/dev
/null
929 chmod a
+r
${LIB}/$file 2>/dev
/null
932 if [ -r ${LIB}/$file ]; then
934 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.
sed
935 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
936 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
939 # Find any include directives that use "file".
940 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
941 dir
=`echo $file | sed -e s'|/[^/]*$||'`
942 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
947 # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
948 # Also wrap protection around size_t for m88k-sysv3 systems.
950 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
951 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
952 chmod +w
${LIB}/$file 2>/dev
/null
953 chmod a
+r
${LIB}/$file 2>/dev
/null
956 if [ -r ${LIB}/$file ]; then
958 if grep _GCC_SIZE_T
${LIB}/$file >/dev
/null
959 then size_t_pattern
='<<< do not double-wrap the size_t typedef >>>'
960 else size_t_pattern
='typedef[ a-zA-Z_]*[ ]size_t[ ]*;'
962 sed -e 's/int abort/void abort/g' \
963 -e 's/int free/void free/g' \
964 -e 's/char[ ]*\*[ ]*calloc/void \* calloc/g' \
965 -e 's/char[ ]*\*[ ]*malloc/void \* malloc/g' \
966 -e 's/char[ ]*\*[ ]*realloc/void \* realloc/g' \
967 -e 's/int[ ][ ]*exit/void exit/g' \
968 -e "/$size_t_pattern/"'i\
972 -e "/$size_t_pattern/"'a\
975 ${LIB}/$file > ${LIB}/${file}.
sed
976 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
977 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
980 # Find any include directives that use "file".
981 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
982 dir
=`echo $file | sed -e s'|/[^/]*$||'`
983 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
988 # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
989 # Also fix return type of {m,re}alloc in <malloc.h> on sysV68
991 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
992 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
993 chmod +w
${LIB}/$file 2>/dev
/null
994 chmod a
+r
${LIB}/$file 2>/dev
/null
997 if [ -r ${LIB}/$file ]; then
999 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
1000 -e 's/int[ ][ ]*free/void free/g' \
1001 -e 's/char\([ ]*\*[ ]*malloc\)/void\1/g' \
1002 -e 's/char\([ ]*\*[ ]*realloc\)/void\1/g' \
1003 ${LIB}/$file > ${LIB}/${file}.
sed
1004 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1005 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1008 # Find any include directives that use "file".
1009 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1010 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1011 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1016 # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
1017 file=hsfs
/hsfs_spec.h
1018 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1019 mkdir
${LIB}/hsfs
2>/dev
/null
1020 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1021 chmod +w
${LIB}/$file 2>/dev
/null
1022 chmod a
+r
${LIB}/$file 2>/dev
/null
1025 if [ -r ${LIB}/$file ]; then
1027 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
1028 ${LIB}/$file > ${LIB}/${file}.
1029 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
1030 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1033 # Find any include directives that use "file".
1034 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1035 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1036 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1041 # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
1043 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1044 mkdir
${LIB}/hsfs
2>/dev
/null
1045 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1046 chmod +w
${LIB}/$file 2>/dev
/null
1047 chmod a
+r
${LIB}/$file 2>/dev
/null
1050 if [ -r ${LIB}/$file ]; then
1052 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
1053 ${LIB}/$file > ${LIB}/${file}.
sed
1054 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1055 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1058 # Find any include directives that use "file".
1059 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1060 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1061 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1066 # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
1067 file=hsfs
/iso_spec.h
1068 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1069 mkdir
${LIB}/hsfs
2>/dev
/null
1070 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1071 chmod +w
${LIB}/$file 2>/dev
/null
1072 chmod a
+r
${LIB}/$file 2>/dev
/null
1075 if [ -r ${LIB}/$file ]; then
1077 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
1078 ${LIB}/$file > ${LIB}/${file}.
sed
1079 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1080 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1083 # Find any include directives that use "file".
1084 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1085 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1086 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1091 # Incorrect #include in Sony News-OS 3.2.
1092 file=machine
/machparam.h
1093 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1094 mkdir
${LIB}/machine
2>/dev
/null
1095 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1096 chmod +w
${LIB}/$file 2>/dev
/null
1097 chmod a
+r
${LIB}/$file 2>/dev
/null
1100 if [ -r ${LIB}/$file ]; then
1101 echo Fixing
$file, incorrect \
#include
1102 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
1103 ${LIB}/$file > ${LIB}/${file}.
1104 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
1105 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1108 # Find any include directives that use "file".
1109 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1110 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1111 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1116 # Multiline comment after typedef on IRIX 4.0.1.
1118 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1119 mkdir
${LIB}/sys
2>/dev
/null
1120 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1121 chmod +w
${LIB}/$file 2>/dev
/null
1122 chmod a
+r
${LIB}/$file 2>/dev
/null
1125 if [ -r ${LIB}/$file ]; then
1126 echo Fixing
$file, comment
in the middle of \
#ifdef
1127 sed -e 's@type of the result@type of the result */@' \
1128 -e 's@of the sizeof@/* of the sizeof@' \
1129 ${LIB}/$file > ${LIB}/${file}.
sed
1130 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1131 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1134 # Find any include directives that use "file".
1135 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1136 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1137 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1142 # Turning // comments into /* */ comments trashes this IRIX 4.0.1
1143 # header file, which embeds // comments inside multi-line /* */
1144 # comments. If this looks like the IRIX header file, we refix it by
1145 # just throwing away the // comments.
1147 if [ -r ${LIB}/$file ]; then
1148 if egrep indigo.esd
${LIB}/$file > /dev
/null
; then
1149 echo Fixing
$file, overeager
sed script
1151 sed -e 's|//.*$||g' $file > ${LIB}/$file
1152 chmod +w
${LIB}/$file 2>/dev
/null
1153 chmod a
+r
${LIB}/$file 2>/dev
/null
1157 # There is a similar problem with the VxWorks drv/netif/if_med.h file.
1158 file=drv
/netif
/if_med.h
1159 if [ -r ${LIB}/$file ]; then
1160 if egrep 'Wind River' ${LIB}/$file > /dev
/null
; then
1161 echo Fixing
$file, overeager
sed script
1163 sed -e 's|//.*$||g' $file > ${LIB}/$file
1164 chmod +w
${LIB}/$file 2>/dev
/null
1165 chmod a
+r
${LIB}/$file 2>/dev
/null
1169 # And also with the HP-UX 10 and HP-UX 11 sys/pci.h file
1171 if [ -r ${LIB}/$file ]; then
1172 if egrep 'System Private Structures' ${LIB}/$file > /dev
/null
; then
1173 echo Fixing
$file, overeager
sed script
1175 sed -e 's|//.*$||g' $file > ${LIB}/$file
1176 chmod +w
${LIB}/$file 2>/dev
/null
1177 chmod a
+r
${LIB}/$file 2>/dev
/null
1181 # And also with a few more HP-UX 11 headers which are only broken
1182 # after they are "fixed".
1184 if [ -r ${LIB}/$file ]; then
1185 if egrep 'These definitions are for HP Internal developers' ${LIB}/$file > /dev
/null
; then
1186 echo Fixing
$file, overeager
sed script
1192 if [ -r ${LIB}/$file ]; then
1193 if egrep '11.00 HP-UX LP64' ${LIB}/$file > /dev
/null
; then
1194 echo Fixing
$file, overeager
sed script
1200 if [ -r ${LIB}/$file ]; then
1201 if egrep 'KI_MAX_PROCS is an arbitrary number' ${LIB}/$file > /dev
/null
; then
1202 echo Fixing
$file, overeager
sed script
1208 if [ -r ${LIB}/$file ] ; then
1209 if egrep 'Kernel Instrumentation Definitions' ${LIB}/$file > /dev
/null
; then
1210 echo Fixing
$file, overeager
sed script
1216 if [ -r ${LIB}/$file ] ; then
1217 if egrep 'For CASPEC, look in' ${LIB}/$file > /dev
/null
; then
1218 echo Fixing
$file, overeager
sed script
1223 # Some IRIX header files contains the string "//"
1224 for file in elf_abi.h elf.h
; do
1225 if [ -r ${LIB}/$file ]; then
1226 echo Fixing
$file, overeager
sed script
1227 sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.
sed
1228 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1229 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1232 # Find any include directives that use "file".
1233 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1234 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1235 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1241 # IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr in prototype without
1242 # previous definition.
1244 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1245 mkdir
${LIB}/rpc
2>/dev
/null
1246 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1247 chmod +w
${LIB}/$file 2>/dev
/null
1248 chmod a
+r
${LIB}/$file 2>/dev
/null
1251 if [ -r ${LIB}/$file ]; then
1252 echo Fixing
$file, undefined
type
1253 sed -e '/authdes_create.*struct sockaddr/i\
1256 ${LIB}/$file > ${LIB}/$file.
sed
1257 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1258 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1261 # Find any include directives that use "file".
1262 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1263 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1264 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1269 # IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s in prototype without previous
1272 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1273 mkdir
${LIB}/rpc
2>/dev
/null
1274 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1275 chmod +w
${LIB}/$file 2>/dev
/null
1276 chmod a
+r
${LIB}/$file 2>/dev
/null
1279 if [ -r ${LIB}/$file ]; then
1280 echo Fixing
$file, undefined
type
1281 sed -e '/xdrstdio_create.*struct __file_s/i\
1284 ${LIB}/$file > ${LIB}/$file.
sed
1285 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1286 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1289 # Find any include directives that use "file".
1290 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1291 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1292 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1297 # Same problem with a file from SunOS 4.1.3 : a header file containing
1298 # the string "//" embedded in "/**/"
1299 file=sbusdev
/audiovar.h
1300 if [ -r ${LIB}/$file ]; then
1301 echo Fixing
$file, overeager
sed script
1303 sed -e 's|//.*$||g' $file > ${LIB}/$file
1304 chmod +w
${LIB}/$file 2>/dev
/null
1305 chmod a
+r
${LIB}/$file 2>/dev
/null
1308 # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
1309 # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
1310 # many other systems have similar text but correct versions of the file.
1311 # To ensure only Sun's is fixed, we grep for a likely unique string.
1312 # Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
1314 if [ -r $file ] && egrep '/\* @\(#\)(head/memory.h 50.1 |memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 )\*/' $file > /dev
/null
; then
1315 if [ ! -r ${LIB}/$file ]; then
1316 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1317 chmod +w
${LIB}/$file 2>/dev
/null
1318 chmod a
+r
${LIB}/$file 2>/dev
/null
1320 if [ -r ${LIB}/$file ]; then
1321 echo Replacing
$file
1322 cat > ${LIB}/$file << EOF
1323 /* This file was generated by fixincludes */
1324 #ifndef __memory_h__
1325 #define __memory_h__
1328 extern void *memccpy();
1329 extern void *memchr();
1330 extern void *memcpy();
1331 extern void *memset();
1333 extern char *memccpy();
1334 extern char *memchr();
1335 extern char *memcpy();
1336 extern char *memset();
1337 #endif /* __STDC__ */
1339 extern int memcmp();
1341 #endif /* __memory_h__ */
1346 # Fix return type of fread and fwrite on sysV68
1348 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1349 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1350 chmod +w
${LIB}/$file 2>/dev
/null
1351 chmod a
+r
${LIB}/$file 2>/dev
/null
1354 if [ -r ${LIB}/$file ]; then
1355 echo Fixing
$file, fread and fwrite
return type
1356 sed -e 's/^\(extern int fclose(), fflush()\), \(fread(), fwrite()\)\(.*\)$/extern unsigned int \2;\
1358 ${LIB}/$file > ${LIB}/${file}.
sed
1359 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1360 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1363 # Find any include directives that use "file".
1364 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1365 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1366 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1371 # parameters not const on DECstation Ultrix V4.0 and OSF/1.
1373 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1374 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1375 chmod +w
${LIB}/$file 2>/dev
/null
1376 chmod a
+r
${LIB}/$file 2>/dev
/null
1379 if [ -r ${LIB}/$file ]; then
1380 echo Fixing
$file, non-const arg
1381 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
1382 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
1383 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
1384 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
1385 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
1386 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
1387 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
1388 -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
1389 -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
1390 ${LIB}/$file > ${LIB}/${file}.
sed
1391 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1392 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1395 # Find any include directives that use "file".
1396 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1397 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1398 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1403 # parameters conflict with C++ new on rs/6000
1404 for file in stdio.h unistd.h
; do
1405 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1406 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1407 chmod +w
${LIB}/$file 2>/dev
/null
1410 if [ -r ${LIB}/$file ]; then
1411 echo Fixing
$file, parameter name conflicts
1412 sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
1413 ${LIB}/$file > ${LIB}/${file}.
sed
1414 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1415 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1418 # Find any include directives that use "file".
1419 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1420 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1421 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1427 # function class(double x) conflicts with C++ keyword on rs/6000
1429 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1430 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1431 chmod +w
${LIB}/$file 2>/dev
/null
1432 chmod a
+r
${LIB}/$file 2>/dev
/null
1435 if [ -r ${LIB}/$file ]; then
1436 if grep '[^a-zA-Z_]class[(]' ${LIB}/$file >/dev
/null
; then
1438 sed -e '/class[(]/i\
1443 ' ${LIB}/$file > ${LIB}/${file}.
sed
1444 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1445 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1448 # Find any include directives that use "file".
1449 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1450 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1451 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1457 # Wrong fchmod prototype on RS/6000.
1459 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1460 mkdir
${LIB}/sys
2>/dev
/null
1461 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1462 chmod +w
${LIB}/$file 2>/dev
/null
1463 chmod a
+r
${LIB}/$file 2>/dev
/null
1466 if [ -r ${LIB}/$file ]; then
1467 echo Fixing
$file, fchmod prototype
1468 sed -e 's/fchmod(char \*/fchmod(int/' \
1469 ${LIB}/$file > ${LIB}/$file.
sed
1470 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1471 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1474 # Find any include directives that use "file".
1475 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1476 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1477 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1482 # There are several name conflicts with C++ reserved words in X11
1483 # header files. These are fixed in some versions, so don't do the
1484 # fixes if we find __cplusplus in the file. These were found on the
1487 # class in X11/ShellP.h
1489 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1490 mkdir
${LIB}/sys
2>/dev
/null
1491 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1492 chmod +w
${LIB}/$file 2>/dev
/null
1493 chmod a
+r
${LIB}/$file 2>/dev
/null
1496 if [ -r ${LIB}/$file ]; then
1497 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1500 echo Fixing
$file, field class
1501 sed -e '/char [*]class;/i\
1506 -e '/char [*]class;/a\
1508 ' ${LIB}/$file > ${LIB}/${file}.
sed
1509 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1511 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1514 # Find any include directives that use "file".
1515 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1516 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1517 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1521 # new in Xm/Traversal.h
1523 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1524 mkdir
${LIB}/sys
2>/dev
/null
1525 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1526 chmod +w
${LIB}/$file 2>/dev
/null
1527 chmod a
+r
${LIB}/$file 2>/dev
/null
1530 if [ -r ${LIB}/$file ]; then
1531 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1534 echo Fixing
$file, uses of new
1535 sed -e '/Widget old, new;/i\
1540 -e '/Widget old, new;/a\
1543 -e 's/Widget new,/Widget c_new,/g' ${LIB}/$file > ${LIB}/${file}.
sed
1544 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1546 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1549 # Find any include directives that use "file".
1550 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1551 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1552 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1556 # class in Xm/BaseClassI.h
1557 file=Xm
/BaseClassI.h
1558 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1559 mkdir
${LIB}/sys
2>/dev
/null
1560 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1561 chmod +w
${LIB}/$file 2>/dev
/null
1562 chmod a
+r
${LIB}/$file 2>/dev
/null
1565 if [ -r ${LIB}/$file ]; then
1566 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1569 echo Fixing
$file, prototype parameter name
1570 sed -e 's/ class[)]/ c_class)/g' ${LIB}/$file > ${LIB}/${file}.
sed
1571 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1573 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1576 # Find any include directives that use "file".
1577 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1578 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1579 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1584 # NeXT 3.2 adds const prefix to some math functions. These conflict
1585 # with the built-in functions.
1587 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1588 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1589 chmod +w
${LIB}/$file 2>/dev
/null
1591 if [ -r ${LIB}/$file ]; then
1593 sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \
1594 -e '/^extern.*double.*__const__.*fabs(/s/__const__//' \
1595 -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
1596 -e '/^extern.*double.*__const__.*hypot(/s/__const__//' \
1597 -e '/^extern.*double.*__const__.*sin(/s/__const__//' ${LIB}/$file > ${LIB}/${file}.
sed
1598 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1599 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1602 # Find any include directives that use "file".
1603 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1604 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1605 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1610 # NeXT 3.2 uses the word "template" as a parameter for some
1611 # functions. GCC reports an invalid use of a reserved key word
1612 # with the built-in functions. NeXT 3.2 includes the keyword
1613 # volatile in the prototype for abort(). This conflicts with
1614 # the built-in definition.
1616 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1617 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1618 chmod +w
${LIB}/$file 2>/dev
/null
1620 if [ -r ${LIB}/$file ]; then
1622 sed -e '/\(.*template\)/s/template//' \
1623 -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.
sed
1624 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1625 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1628 # Find any include directives that use "file".
1629 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1630 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1631 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1636 # NeXT 3.2 includes the keyword volatile in the abort() and
1637 # exit() function prototypes. That conflicts with the
1638 # built-in functions.
1640 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1641 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1642 chmod +w
${LIB}/$file 2>/dev
/null
1644 if [ -r ${LIB}/$file ]; then
1646 sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
1647 -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.
sed
1648 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1649 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1652 # Find any include directives that use "file".
1653 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1654 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1655 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1660 # sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
1661 # of struct rusage, so the prototype (added by fixproto) causes havoc.
1663 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1664 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1665 chmod +w
${LIB}/$file 2>/dev
/null
1668 if [ -r ${LIB}/$file ] \
1669 && grep 'bos325,' ${LIB}/$file >/dev
/null
; then
1670 echo Fixing
$file, wait3 declaration
1671 sed -e '/^extern pid_t wait3();$/i\
1674 ${LIB}/$file > ${LIB}/${file}.
sed
1675 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1676 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1679 # Find any include directives that use "file".
1680 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1681 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1682 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1687 # NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1688 # Note that version 3 of the NeXT system has wait.h in a different directory,
1689 # so that this code won't do anything. But wait.h in version 3 has a
1690 # conditional, so it doesn't need this fix. So everything is okay.
1692 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1693 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1694 chmod +w
${LIB}/$file 2>/dev
/null
1697 if [ -r ${LIB}/$file ] \
1698 && grep 'wait[(]union wait' ${LIB}/$file >/dev
/null
; then
1699 echo Fixing
$file, bad
wait formal
1700 sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.
sed
1701 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1702 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1705 # Find any include directives that use "file".
1706 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1707 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1708 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1713 # Don't use or define the name va_list in stdio.h.
1714 # This is for ANSI and also to interoperate properly with gcc's varargs.h.
1716 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1717 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1718 chmod +w
${LIB}/$file 2>/dev
/null
1719 chmod a
+r
${LIB}/$file 2>/dev
/null
1722 if [ -r ${LIB}/$file ]; then
1723 echo Fixing
$file, use of va_list
1724 # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1725 if egrep "__need___va_list" ${LIB}/$file >/dev
/null
2>&1; then
1726 touch ${LIB}/${file}.
sed
1728 (echo "#define __need___va_list"
1729 echo "#include <stdarg.h>") > ${LIB}/${file}.
sed
1731 # Use __gnuc_va_list in arg types in place of va_list.
1732 # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1733 # trailing parentheses and semicolon save all other systems from this.
1734 # Define __va_list__ (something harmless and unused) instead of va_list.
1735 # Don't claim to have defined va_list.
1736 sed -e 's@ va_list @ __gnuc_va_list @' \
1737 -e 's@ va_list)@ __gnuc_va_list)@' \
1738 -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
1739 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
1740 -e 's@ va_list@ __va_list__@' \
1741 -e 's@\*va_list@*__va_list__@' \
1742 -e 's@ __va_list)@ __gnuc_va_list)@' \
1743 -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
1744 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
1745 -e 's@VA_LIST@DUMMY_VA_LIST@' \
1746 -e 's@_Va_LIST@_VA_LIST@' \
1747 ${LIB}/$file >> ${LIB}/${file}.
sed
1749 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1750 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1753 # Find any include directives that use "file".
1754 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1755 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1756 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1761 # Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
1763 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1764 if grep -s ULTRIX
$file; then
1765 echo "/* This file intentionally left blank. */" > $LIB/$file
1769 # parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
1770 # also get rid of bogus inline definitions in HP-UX 8.0
1772 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1773 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1774 chmod +w
${LIB}/$file 2>/dev
/null
1775 chmod a
+r
${LIB}/$file 2>/dev
/null
1778 if [ -r ${LIB}/$file ]; then
1779 echo Fixing
$file, non-const arg
1780 sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \
1781 -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
1782 -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
1783 -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
1784 -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
1785 ${LIB}/$file > ${LIB}/${file}.
sed
1786 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1787 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1790 # Find any include directives that use "file".
1791 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1792 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1793 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1798 # fix bogus recursive stdlib.h in NEWS-OS 4.0C
1800 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1801 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1802 chmod +w
${LIB}/$file 2>/dev
/null
1803 chmod a
+r
${LIB}/$file 2>/dev
/null
1806 if [ -r ${LIB}/$file ]; then
1807 echo Fixing
$file, recursive inclusion
1808 sed -e '/^#include <stdlib.h>/i\
1811 -e '/^#include <stdlib.h>/a\
1814 ${LIB}/$file > ${LIB}/${file}.
sed
1815 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1816 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1819 # Find any include directives that use "file".
1820 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1821 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1822 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1827 # Avoid nested comments on Ultrix 4.3.
1829 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1830 mkdir
${LIB}/rpc
2>/dev
/null
1831 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1832 chmod +w
${LIB}/$file 2>/dev
/null
1833 chmod a
+r
${LIB}/$file 2>/dev
/null
1836 if [ -r ${LIB}/$file ]; then
1837 echo Fixing
$file, nested comment
1838 sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
1839 ${LIB}/$file > ${LIB}/$file.
sed
1840 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1841 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1844 # Find any include directives that use "file".
1845 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1846 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1847 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1852 # This file in RISC/os uses /**/ to concatenate two tokens.
1854 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1855 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1856 chmod +w
${LIB}/$file 2>/dev
/null
1857 chmod a
+r
${LIB}/$file 2>/dev
/null
1859 if [ -r ${LIB}/$file ]; then
1860 sed -e 's|/\*\*/|##|' ${LIB}/$file > ${LIB}/${file}.
sed
1861 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1862 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1865 # Find any include directives that use "file".
1866 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1867 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1868 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1874 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1875 mkdir
${LIB}/rpc
2>/dev
/null
1876 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1877 chmod +w
${LIB}/$file 2>/dev
/null
1878 chmod a
+r
${LIB}/$file 2>/dev
/null
1881 if [ -r ${LIB}/$file ]; then
1882 echo Fixing
$file, nested comment
1883 sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
1884 ${LIB}/$file > ${LIB}/$file.
sed
1885 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1886 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1889 # Find any include directives that use "file".
1890 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1891 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1892 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1897 # rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
1898 # is defined for the alpha. The problem is the declaration of malloc.
1900 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1901 mkdir
${LIB}/rpc
2>/dev
/null
1902 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1903 chmod +w
${LIB}/$file 2>/dev
/null
1904 chmod a
+r
${LIB}/$file 2>/dev
/null
1906 if [ -r ${LIB}/$file ]; then
1907 if egrep '"C"' ${LIB}/$file >/dev
/null
2>&1; then
1911 echo '#ifdef __cplusplus
1913 #endif' > ${LIB}/${file}.
sed
1914 cat ${LIB}/${file} >> ${LIB}/${file}.
sed
1915 echo '#ifdef __cplusplus
1917 #endif' >> ${LIB}/${file}.
sed
1918 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1919 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1922 # Find any include directives that use "file".
1923 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1924 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1925 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1931 # In limits.h, put #ifndefs around things that are supposed to be defined
1932 # in float.h to avoid redefinition errors if float.h is included first.
1933 # On HP/UX this patch does not work, because on HP/UX limits.h uses
1934 # multi line comments and the inserted #endif winds up inside the
1935 # comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1936 # we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1937 # are there, and we do not add them ourselves.
1938 # Also fix a nested comment problem in sys/limits.h on Motorola sysV68 R3V7.1
1939 for file in limits.h sys
/limits.h
; do
1940 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1941 mkdir
${LIB}/sys
2>/dev
/null
1942 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1943 chmod +w
${LIB}/$file 2>/dev
/null
1944 chmod a
+r
${LIB}/$file 2>/dev
/null
1947 if [ -r ${LIB}/$file ]; then
1948 if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev
/null
; then
1952 sed -e '/[ ]FLT_MIN[ ]/i\
1955 -e '/[ ]FLT_MIN[ ]/a\
1958 -e '/[ ]FLT_MAX[ ]/i\
1961 -e '/[ ]FLT_MAX[ ]/a\
1964 -e '/[ ]FLT_DIG[ ]/i\
1967 -e '/[ ]FLT_DIG[ ]/a\
1970 -e '/[ ]DBL_MIN[ ]/i\
1973 -e '/[ ]DBL_MIN[ ]/a\
1976 -e '/[ ]DBL_MAX[ ]/i\
1979 -e '/[ ]DBL_MAX[ ]/a\
1982 -e '/[ ]DBL_DIG[ ]/i\
1985 -e '/[ ]DBL_DIG[ ]/a\
1988 -e '/^\(\/\*#define HUGE_VAL 3\.[0-9e+]* *\)\/\*/s//\1/'\
1989 ${LIB}/$file > ${LIB}/${file}.
sed
1990 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1992 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1993 echo Deleting
${LIB}/$file\
; no fixes were needed.
1996 # Find any include directives that use "file".
1997 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1998 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1999 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2005 # In math.h, put #ifndefs around things that might be defined in a gcc
2006 # specific math-*.h file.
2008 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2009 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2010 chmod +w
${LIB}/$file 2>/dev
/null
2011 chmod a
+r
${LIB}/$file 2>/dev
/null
2014 if [ -r ${LIB}/$file ]; then
2016 sed -e '/define[ ]HUGE_VAL[ ]/i\
2019 -e '/define[ ]HUGE_VAL[ ]/a\
2022 ${LIB}/$file > ${LIB}/${file}.
sed
2023 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2025 # In addition, copy the definition of DBL_MAX from float.h
2026 # if math.h requires one. The Lynx math.h requires it.
2027 if egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file >/dev
/null
2>&1; then
2028 if egrep '#define[ ]+DBL_MAX[ ]+' $file >/dev
/null
2>&1; then
2031 dbl_max_def
=`egrep 'define[ ]+DBL_MAX[ ]+.*' float.h 2>/dev/null`
2032 if [ "$dbl_max_def" != "" ]; then
2033 dbl_max_def
=`echo $dbl_max_def | sed 's/.*define[ ]*DBL_MAX[ ]*//'`
2034 sed -e "/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/" \
2035 ${LIB}/$file > ${LIB}/${file}.
sed
2036 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2041 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2042 echo Deleting
${LIB}/$file\
; no fixes were needed.
2045 # Find any include directives that use "file".
2046 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2047 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2048 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2053 # Remove erroneous parentheses in sym.h on Alpha OSF/1.
2055 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2056 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2057 chmod +w
${LIB}/$file 2>/dev
/null
2058 chmod a
+r
${LIB}/$file 2>/dev
/null
2061 if [ -r ${LIB}/$file ]; then
2063 sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
2064 ${LIB}/$file > ${LIB}/${file}.
sed
2065 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2066 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2069 # Find any include directives that use "file".
2070 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2071 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2072 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2077 # Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
2078 # in string.h on sysV68
2079 # Correct the return type for strlen in string.h on Lynx.
2080 # Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
2081 # Add missing const for strdup on OSF/1 V3.0.
2082 # On sysV88 layout is slightly different.
2084 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2085 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2086 chmod +w
${LIB}/$file 2>/dev
/null
2087 chmod a
+r
${LIB}/$file 2>/dev
/null
2090 if [ -r ${LIB}/$file ]; then
2091 echo Fixing
$file, mem
{ccpy
,chr
,cpy
,set} and str
{len
,spn
,cspn
} return value
2092 sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \
2093 -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \
2094 -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
2095 -e '/^extern char$/N' \
2096 -e 's/^extern char\(\n \*memccpy(),\)$/extern void\1/'\
2097 -e '/^ strncmp(),$/N'\
2098 -e 's/^\( strncmp()\),\n\( strlen(),\)$/\1;\
2099 extern unsigned int\
2101 -e '/^extern int$/N'\
2102 -e 's/^extern int\(\n strlen(),\)/extern size_t\1/' \
2103 ${LIB}/$file > ${LIB}/${file}.
sed
2104 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2105 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2108 # Find any include directives that use "file".
2109 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2110 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2111 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2116 # Correct the return type for strlen in strings.h in SunOS 4.
2118 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2119 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2120 chmod +w
${LIB}/$file 2>/dev
/null
2121 chmod a
+r
${LIB}/$file 2>/dev
/null
2124 if [ -r ${LIB}/$file ]; then
2126 sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \
2127 ${LIB}/$file > ${LIB}/${file}.
sed
2128 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2129 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2132 # Find any include directives that use "file".
2133 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2134 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2135 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2140 # Delete the '#define void int' line from curses.h on Lynx
2142 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2143 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2144 chmod +w
${LIB}/$file 2>/dev
/null
2145 chmod a
+r
${LIB}/$file 2>/dev
/null
2148 if [ -r ${LIB}/$file ]; then
2150 sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \
2151 ${LIB}/$file > ${LIB}/${file}.
sed
2152 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2153 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2156 # Find any include directives that use "file".
2157 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2158 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2159 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2164 # Fix `typedef struct term;' on hppa1.1-hp-hpux9.
2166 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2167 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2168 chmod +w
${LIB}/$file 2>/dev
/null
2169 chmod a
+r
${LIB}/$file 2>/dev
/null
2172 if [ -r ${LIB}/$file ]; then
2174 sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \
2175 ${LIB}/$file > ${LIB}/${file}.
sed
2176 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2177 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2180 # Find any include directives that use "file".
2181 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2182 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2183 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2188 # For C++, avoid any typedef or macro definition of bool, and use the
2189 # built in type instead.
2190 for files
in curses.h
; do
2191 if [ -r $file ] && egrep bool
$file >/dev
/null
2>&1; then
2192 if [ ! -r ${LIB}/$file ]; then
2193 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2194 chmod +w
${LIB}/$file 2>/dev
/null
2195 chmod a
+r
${LIB}/$file 2>/dev
/null
2199 sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
2202 -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
2205 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\
2208 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\
2211 ${LIB}/$file > ${LIB}/${file}.
sed
2212 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2213 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2216 # Find any include directives that use "file".
2217 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2218 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2219 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2225 # Fix incorrect S_IF* definitions on m88k-sysv3.
2227 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2228 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2229 chmod +w
${LIB}/$file 2>/dev
/null
2230 chmod a
+r
${LIB}/$file 2>/dev
/null
2233 if [ -r ${LIB}/$file ]; then
2235 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)/' \
2236 -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
2237 ${LIB}/$file > ${LIB}/${file}.
sed
2238 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2239 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2242 # Find any include directives that use "file".
2243 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2244 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2245 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2250 # Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
2251 for file in limits.h sys
/limits.h
; do
2252 if [ $target_canonical = m88k-motorola-sysv3
-o \
2253 $target_canonical = m68k-motorola-sysv
]; then
2255 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2256 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2257 chmod +w
${LIB}/$file 2>/dev
/null
2258 chmod a
+r
${LIB}/$file 2>/dev
/null
2261 if [ -r ${LIB}/$file ]; then
2262 echo "Fixing nested comments in Motorola's $file"
2264 -e 's@^\(#undef[ ][ ]*PIPE_BUF[ ]*/\* max # bytes atomic in write to a\)$@\1 */@' \
2265 -e 's@\(/\*#define HUGE_VAL 3.40282346638528860e+38 \)\(/\*error value returned by Math lib\*/\)$@\1*/ \2@' \
2266 < ${LIB}/$file > ${LIB}/${file}.
sed
2267 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2268 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2275 # Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
2276 for file in stdio.h stdlib.h
; do
2277 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2278 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2279 chmod +w
${LIB}/$file 2>/dev
/null
2280 chmod a
+r
${LIB}/$file 2>/dev
/null
2283 if [ -r ${LIB}/$file ]; then
2284 echo Fixing
$file, getopt declaration
2285 sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
2286 ${LIB}/$file > ${LIB}/${file}.
sed
2287 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2288 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2291 # Find any include directives that use "file".
2292 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2293 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2294 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2300 # Fix __page_size* declarations in pthread.h AIX 4.1.[34].
2301 # The original ones fail if uninitialized externs are not common.
2302 # This is the default for all ANSI standard C++ compilers.
2303 for file in pthread.h
; do
2304 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2305 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2306 chmod +w
${LIB}/$file 2>/dev
/null
2307 chmod a
+r
${LIB}/$file 2>/dev
/null
2310 if [ -r ${LIB}/$file ]; then
2311 echo Fixing
$file, __page_size
* declarations
2312 sed -e 's/^int __page_size/extern int __page_size/' \
2313 ${LIB}/$file > ${LIB}/${file}.
sed
2314 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2315 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2318 # Find any include directives that use "file".
2319 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2320 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2321 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2327 # Determine if we're on Interactive Unix 2.2 or later, in which case we
2328 # need to fix some additional files. This is the same test for ISC that
2330 if test -d /etc
/conf
/kconfig.d \
2331 && grep _POSIX_VERSION
/usr
/include
/sys
/unistd.h
>/dev
/null
2>&1; then
2332 echo "Fixing ISC __STDC__ goof in several files..."
2333 for name
in stdio.h math.h ctype.h sys
/limits.h sys
/fcntl.h sys
/dirent.h
; do
2335 if test -r ${LIB}/$name; then
2340 # On Interactive 2.2, certain traditional Unix definitions
2341 # (notably getc and putc in stdio.h) are omitted if __STDC__ is
2342 # defined, not just if _POSIX_SOURCE is defined. This makes it
2343 # impossible to compile any nontrivial program except with -posix.
2345 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
2346 < $file > ${LIB}/$name.
2347 mv ${LIB}/$name.
${LIB}/$name
2350 echo "Fixing ISC fmod declaration"
2351 # This one's already been fixed for other things.
2353 sed 's/fmod(double)/fmod(double, double)/' <$file >$file.
2356 echo "Fixing nested comments in ISC <sys/limits.h>"
2358 sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file.
2359 sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file.
>${LIB}/$file
2362 # These files in Sun OS 4.x use /**/ to concatenate tokens.
2363 for file in sparc
/asm_linkage.h sun
3/asm_linkage.h sun3x
/asm_linkage.h \
2364 sun
4/asm_linkage.h sun4c
/asm_linkage.h sun4m
/asm_linkage.h \
2365 sun4c
/debug
/asm_linkage.h sun4m
/debug
/asm_linkage.h
;
2367 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2368 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2369 chmod +w
${LIB}/$file 2>/dev
/null
2370 chmod a
+r
${LIB}/$file 2>/dev
/null
2373 if [ -r ${LIB}/$file ]; then
2374 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
2375 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2376 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2379 # Find any include directives that use "file".
2380 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2381 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2382 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2388 # These files in ARM/RISCiX use /**/ to concatenate tokens.
2389 for file in arm
/as_support.h
arm
/mc_type.h
arm
/xcb.h dev
/chardefmac.h \
2390 dev
/ps_irq.h dev
/screen.h dev
/scsi.h sys
/tty.h Xm.acorn
/XmP.h
2392 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2393 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2394 chmod +w
${LIB}/$file 2>/dev
/null
2395 chmod a
+r
${LIB}/$file 2>/dev
/null
2398 if [ -r ${LIB}/$file ]; then
2399 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
2400 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2401 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2404 # Find any include directives that use "file".
2405 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2406 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2407 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2413 # libm.a on m88k-motorola-sysv3 contains a stupid optimization for function
2414 # hypot(), which returns the second argument without even looking at its value
2415 # if the other is 0.0
2416 # Another drawback is that fix-header doesn't fix fabs' prototype, and I have
2419 if [ $target_canonical = m88k-motorola-sysv3
]; then
2420 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2421 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2422 chmod +w
${LIB}/$file 2>/dev
/null
2423 chmod a
+r
${LIB}/$file 2>/dev
/null
2426 if [ -r ${LIB}/$file ]; then
2427 echo Fixing
$file, fabs
/hypot definition
2429 -e 's/extern double floor(), ceil(), fmod(), fabs();/extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/' \
2430 -e '/^extern double hypot();$/a\
2431 \/* Workaround a stupid Motorola optimization if one\
2432 of x or y is 0.0 and the other is negative! *\/\
2434 static __inline__ double fake_hypot (double x, double y)\
2436 static __inline__ double fake_hypot (x, y)\
2440 return fabs (hypot (x, y));\
2442 #define hypot fake_hypot
2444 ${LIB}/$file > ${LIB}/${file}.
sed
2445 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2446 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2452 # math.h on SunOS 4 puts the declaration of matherr before the definition
2453 # of struct exception, so the prototype (added by fixproto) causes havoc.
2455 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2456 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2457 chmod +w
${LIB}/$file 2>/dev
/null
2458 chmod a
+r
${LIB}/$file 2>/dev
/null
2461 if [ -r ${LIB}/$file ]; then
2462 echo Fixing
$file, matherr declaration
2463 sed -e '/^struct exception/,$b' \
2467 ${LIB}/$file > ${LIB}/${file}.
sed
2468 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2469 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2472 # Find any include directives that use "file".
2473 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2474 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2475 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2480 # sys/mman.h on HP/UX is not C++ ready, even though
2481 # NO_IMPLICIT_EXTERN_C is defined on HP/UX.
2482 for file in sys
/mman.h
; do
2483 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2484 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2485 chmod +w
${LIB}/$file 2>/dev
/null
2486 chmod a
+r
${LIB}/$file 2>/dev
/null
2489 if [ -r ${LIB}/$file ]; then
2490 if egrep '"C"' ${LIB}/$file >/dev
/null
2>&1 \
2491 ||
egrep '__BEGIN_DECLS' ${LIB}/$file >/dev
/null
2>&1; then
2495 echo '#ifdef __cplusplus
2497 #endif' > ${LIB}/${file}.
sed
2498 cat ${LIB}/${file} >> ${LIB}/${file}.
sed
2499 echo '#ifdef __cplusplus
2501 #endif' >> ${LIB}/${file}.
sed
2502 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2504 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2507 # Find any include directives that use "file".
2508 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2509 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2510 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2516 # Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
2518 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2519 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2520 chmod +w
${LIB}/$file 2>/dev
/null
2521 chmod a
+r
${LIB}/$file 2>/dev
/null
2524 if [ -r ${LIB}/$file ]; then
2525 echo Fixing
$file, sbrk declaration
2526 sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \
2527 ${LIB}/$file > ${LIB}/${file}.
sed
2528 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2529 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2532 # Find any include directives that use "file".
2533 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2534 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2535 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2540 # This file on SunOS 4 has a very large macro. When the sed loop
2541 # tries pull it in, it overflows the pattern space size of the SunOS
2542 # sed (GNU sed does not have this problem). Since the file does not
2543 # require fixing, we remove it from the fixed directory.
2544 file=sundev
/ipi_error.h
2545 if [ -r ${LIB}/$file ]; then
2546 echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>"
2550 # Put cpp wrappers around these include files to avoid redeclaration
2551 # errors during multiple inclusion on m88k-tektronix-sysv3.
2552 for file in time.h sys
/time.h
; do
2553 if egrep '#ifndef' $file >/dev
/null
2>&1; then
2556 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2557 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2558 chmod +w
${LIB}/$file 2>/dev
/null
2560 if [ -r ${LIB}/$file ]; then
2561 echo Fixing
$file, to protect against multiple inclusion.
2562 cpp_wrapper
=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
2563 (echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
2564 echo "#define __GCC_GOT_${cpp_wrapper}_"
2566 echo '#endif /* !_GCC_GOT_'${cpp_wrapper}_' */') > ${LIB}/${file}.new
2567 rm -f ${LIB}/$file; mv ${LIB}/${file}.new ${LIB}/$file
2572 # Fix fcntl prototype in fcntl.h on LynxOS.
2574 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2575 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2576 chmod +w
${LIB}/$file 2>/dev
/null
2577 chmod a
+r
${LIB}/$file 2>/dev
/null
2580 if [ -r ${LIB}/$file ]; then
2581 echo Fixing
$file, fcntl declaration
2582 sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
2583 ${LIB}/$file > ${LIB}/${file}.
sed
2584 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2585 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2588 # Find any include directives that use "file".
2589 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2590 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2591 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2596 # Fix definitions of macros used by va-i960.h in VxWorks header file.
2597 file=arch
/i960
/archI960.h
2598 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2599 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2600 chmod +w
${LIB}/$file 2>/dev
/null
2601 chmod a
+r
${LIB}/$file 2>/dev
/null
2604 if [ -r ${LIB}/$file ]; then
2606 sed -e 's/__vsiz/__vxvsiz/' -e 's/__vali/__vxvali/' \
2607 -e s
'/__vpad/__vxvpad/' -e 's/__alignof__/__vxalignof__/' \
2608 ${LIB}/$file > ${LIB}/${file}.
sed
2609 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2610 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2613 # Find any include directives that use "file".
2614 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2615 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2616 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2621 # Make VxWorks header which is almost gcc ready fully gcc ready.
2622 file=types
/vxTypesBase.h
2623 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2624 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2625 chmod +w
${LIB}/$file 2>/dev
/null
2626 chmod a
+r
${LIB}/$file 2>/dev
/null
2629 if [ -r ${LIB}/$file ]; then
2631 sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
2633 #ifndef _GCC_SIZE_T\
2639 -e '/[ ]ptrdiff_t/i\
2640 #ifndef _GCC_PTRDIFF_T\
2641 #define _GCC_PTRDIFF_T
2643 -e '/[ ]ptrdiff_t/a\
2647 #ifndef _GCC_WCHAR_T\
2648 #define _GCC_WCHAR_T
2653 ${LIB}/$file > ${LIB}/${file}.
sed
2654 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2655 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2658 # Find any include directives that use "file".
2659 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2660 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2661 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2666 # Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2668 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2669 mkdir
${LIB}/sys
2>/dev
/null
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 if egrep '#include' ${LIB}/$file >/dev
/null
2>&1; then
2679 if egrep 'ULONG' ${LIB}/$file >/dev
/null
2>&1 \
2680 && [ -r types
/vxTypesOld.h
]; then
2682 sed -e '/#define[ ][ ]*__INCstath/a\
2683 #include <types/vxTypesOld.h>
2685 ${LIB}/$file > ${LIB}/${file}.
sed
2686 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2689 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2692 # Find any include directives that use "file".
2693 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2694 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2695 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2700 # Fix VxWorks <time.h> to not require including <vxTypes.h>.
2702 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2703 mkdir
${LIB}/sys
2>/dev
/null
2704 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2705 chmod +w
${LIB}/$file 2>/dev
/null
2706 chmod a
+r
${LIB}/$file 2>/dev
/null
2709 if [ -r ${LIB}/$file ]; then
2710 if egrep 'uint_t[ ][ ]*_clocks_per_sec' ${LIB}/$file >/dev
/null
2>&1; then
2712 sed -e 's/uint_t/unsigned int/' ${LIB}/$file > ${LIB}/${file}.
sed
2713 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2715 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2718 # Find any include directives that use "file".
2719 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2720 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2721 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2726 # Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
2728 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2729 mkdir
${LIB}/sys
2>/dev
/null
2730 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2731 chmod +w
${LIB}/$file 2>/dev
/null
2732 chmod a
+r
${LIB}/$file 2>/dev
/null
2735 if [ -r ${LIB}/$file ]; then
2736 if egrep '^extern struct sigevent;' ${LIB}/$file >/dev
/null
2>&1; then
2738 sed -e 's/^extern struct sigevent;/struct sigevent;/' ${LIB}/$file > ${LIB}/${file}.
sed
2739 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2741 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2744 # Find any include directives that use "file".
2745 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2746 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2747 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2752 # Another bad dependency in VxWorks 5.2 <time.h>.
2754 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2755 mkdir
${LIB}/sys
2>/dev
/null
2756 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2757 chmod +w
${LIB}/$file 2>/dev
/null
2758 chmod a
+r
${LIB}/$file 2>/dev
/null
2761 if [ -r ${LIB}/$file ]; then
2762 if egrep VOIDFUNCPTR
${LIB}/$file >/dev
/null
2>&1; then
2763 if [ -r vxWorks.h
]; then
2765 sed -e '/VOIDFUNCPTR/i\
2766 #ifndef __gcc_VOIDFUNCPTR_defined\
2768 typedef void (*__gcc_VOIDFUNCPTR) (...);\
2770 typedef void (*__gcc_VOIDFUNCPTR) ();\
2772 #define __gcc_VOIDFUNCPTR_defined\
2775 -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \
2776 ${LIB}/$file > ${LIB}/${file}.
sed
2777 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2780 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2783 # Find any include directives that use "file".
2784 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2785 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2786 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2791 # This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89; gcc
2792 # doesn't understand it.
2794 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2795 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2796 chmod +w
${LIB}/$file 2>/dev
/null
2797 chmod a
+r
${LIB}/$file 2>/dev
/null
2800 if [ -r ${LIB}/$file ]; then
2801 echo "Fixing __asm directive in sys/param.h"
2802 sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \
2803 ${LIB}/$file > ${LIB}/${file}.
sed
2804 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2805 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2808 # Find any include directives that use "file".
2809 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2810 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2811 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2816 # signal.h on SunOS defines signal using (), which causes trouble when
2817 # compiling with g++ -pedantic.
2818 for file in signal.h sys
/signal.h
; do
2819 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2820 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2821 chmod +w
${LIB}/$file 2>/dev
/null
2822 chmod a
+r
${LIB}/$file 2>/dev
/null
2825 if [ -r ${LIB}/$file ]; then
2826 echo "Checking for bad C++ prototype in $file"
2827 sed -e '/^void (\*signal())();$/i\
2829 void (*signal(...))(...);\
2832 -e '/^void (\*signal())();$/a\
2835 ${LIB}/$file > ${LIB}/${file}.
sed
2836 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2837 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2840 # Find any include directives that use "file".
2841 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2842 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2843 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2849 # sys/signal.h on some versions of AIX uses volatile in the typedef of
2850 # sig_atomic_t, which causes gcc to generate a warning about duplicate
2851 # volatile when a sig_atomic_t variable is declared volatile, as
2852 # required by ANSI C.
2854 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2855 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2856 chmod +w
${LIB}/$file 2>/dev
/null
2857 chmod a
+r
${LIB}/$file 2>/dev
/null
2860 if [ -r ${LIB}/$file ]; then
2861 echo "Checking for duplicate volatile in sys/signal.h"
2862 sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' \
2863 ${LIB}/$file > ${LIB}/${file}.
sed
2864 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2865 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2868 # Find any include directives that use "file".
2869 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2870 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2871 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2876 # Some math.h files define struct exception, which conflicts with
2877 # the class exception defined in the C++ file std/stdexcept.h. We
2878 # redefine it to __math_exception. This is not a great fix, but I
2879 # haven't been able to think of anything better.
2881 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2882 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2883 chmod +w
${LIB}/$file 2>/dev
/null
2884 chmod a
+r
${LIB}/$file 2>/dev
/null
2887 if [ -r ${LIB}/$file ]; then
2888 echo Fixing
$file, exception
2889 sed -e '/struct exception/i\
2891 #define exception __math_exception\
2894 -e '/struct exception/a\
2898 ' ${LIB}/$file > ${LIB}/${file}.
sed
2899 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2900 if egrep 'matherr()' ${LIB}/$file >/dev
/null
2>&1; then
2903 #define exception __math_exception\
2910 ' ${LIB}/$file > ${LIB}/${file}.
sed
2911 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2913 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2916 # Find any include directives that use "file".
2917 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2918 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2919 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2924 # rpc/xdr.h on SunOS needs prototypes for its XDR->xdr_ops function pointers.
2926 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2927 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2928 chmod +w
${LIB}/$file 2>/dev
/null
2929 chmod a
+r
${LIB}/$file 2>/dev
/null
2932 if [ -r ${LIB}/$file ]; then
2933 echo "Checking for needed C++ prototype in $file"
2934 sed -e 's/^\(.*\)\*\(x_.*\)();\(.*\)/\
2940 $LIB/$file > ${LIB}/${file}.
sed
2942 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2943 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2946 # Find any include directives that use "file".
2947 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2948 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2949 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2954 # sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
2955 # defining regex.h types. This causes C++ library build and usage failures.
2956 # Fixing this correctly requires checking and modifying 3 files.
2957 for file in reg_types.h regex.h sys
/lc_core.h
; do
2958 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2959 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2960 chmod +w
${LIB}/$file 2>/dev
/null
2961 chmod a
+r
${LIB}/$file 2>/dev
/null
2964 if [ -r ${LIB}/reg_types.h
]; then
2965 if egrep '} regex_t;' ${LIB}/reg_types.h
>/dev
/null
2>&1; then
2966 if [ -r ${LIB}/sys
/lc_core.h
]; then
2967 if egrep ' regex_t ' ${LIB}/sys
/lc_core.h
>/dev
/null
2>&1; then
2968 if [ -r ${LIB}/regex.h
]; then
2969 if egrep '__regex_t' ${LIB}/regex.h
>/dev
/null
2>&1; then
2972 echo Fixing reg_types.h
, regex.h
, sys
/lc_core.h
2973 for file in reg_types.h sys
/lc_core.h
; do
2974 sed -e 's/regex_t/__regex_t/g' \
2975 -e 's/regoff_t/__regoff_t/g' \
2976 -e 's/regmatch_t/__regmatch_t/g' \
2977 ${LIB}/$file > ${LIB}/${file}.
sed
2978 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2980 sed -e '/#include <reg_types.h>/a\
2981 typedef __regex_t regex_t;\
2982 typedef __regoff_t regoff_t;\
2983 typedef __regmatch_t regmatch_t;\
2985 ${LIB}/regex.h
> ${LIB}/regex.h.
sed
2986 rm -f ${LIB}/regex.h; mv ${LIB}/regex.h.sed ${LIB}/regex.h
2993 for file in reg_types.h regex.h sys
/lc_core.h
; do
2994 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2997 # Find any include directives that use "file".
2998 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2999 dir
=`echo $file | sed -e s'|/[^/]*$||'`
3000 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
3005 # AIX headers define NULL to be cast to a void pointer, which is illegal
3007 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
3008 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
3009 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
3010 chmod +w
${LIB}/$file 2>/dev
/null
3011 chmod a
+r
${LIB}/$file 2>/dev
/null
3014 if [ -r ${LIB}/$file ]; then
3015 if egrep '#.*define.*NULL.*void' ${LIB}/$file >/dev
/null
2>&1; then
3016 echo "Fixing $file, bad NULL macro"
3017 sed -e 's/^#[ ]*define[ ]*NULL[ ]*((void[ ]*\*)0)/#define NULL 0/' \
3018 ${LIB}/$file > ${LIB}/${file}.
sed
3019 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
3020 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
3023 # Find any include directives that use "file".
3024 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
3025 dir
=`echo $file | sed -e s'|/[^/]*$||'`
3026 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
3033 # HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
3035 base
=`basename $file`
3036 if [ -r ${LIB}/$file ]; then
3037 file_to_fix
=${LIB}/$file
3039 if [ -r ${INPUT}/$file ]; then
3040 file_to_fix
=${INPUT}/$file
3045 if [ \
! -z "$file_to_fix" ]; then
3046 echo Checking
$file_to_fix
3047 sed -e '/^#[ ]*define[ ]*MAXINT[ ]/i\
3050 -e '/^#[ ]*define[ ]*MAXINT[ ]/a\
3052 ' $file_to_fix > /tmp
/$base
3053 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
3056 echo Fixed
$file_to_fix
3058 cp /tmp
/$base ${LIB}/$file
3059 chmod a
+r
${LIB}/$file
3060 # Find any include directives that use "file".
3061 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
3062 dir
=`echo $file | sed -e s'|/[^/]*$||'`
3063 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
3070 # This loop does not appear to do anything, because it uses file
3071 # rather than $file when setting target. It also appears to be
3072 # unnecessary, since the main loop processes symbolic links.
3074 # echo 'Making internal symbolic non-directory links'
3076 # files=`find . -type l -print`
3077 # for file in $files; do
3078 # dest=`ls -ld $file | sed -n 's/.*-> //p'`
3079 # if expr "$dest" : '[^/].*' > /dev/null; then
3080 # target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
3081 # if [ -f $target ]; then
3082 # ln -s $dest ${LIB}/$file >/dev/null 2>&1
3088 # Make sure that any include files referenced using double quotes
3089 # exist in the fixed directory. This comes last since otherwise
3090 # we might end up deleting some of these files "because they don't
3094 while [ $# != 0 ]; do
3096 while [ $# != 0 ]; do
3097 # $1 is the directory to copy from, $2 is the unfixed file,
3098 # $3 is the fixed file name.
3101 if [ -r $2 ] && [ ! -r $3 ]; then
3102 cp $2 $3 >/dev
/null
2>&1 ||
echo "Can't copy $2"
3103 chmod +w
$3 2>/dev
/null
3104 chmod a
+r
$3 2>/dev
/null
3106 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
3107 dir
=`echo $2 | sed -e s'|/[^/]*$||'`
3108 dir2
=`echo $3 | sed -e s'|/[^/]*$||'`
3109 newreq
="$newreq $1 $dir/$include $dir2/$include"
3118 echo 'Cleaning up DONE files.'
3120 find .
-name DONE
-exec rm -f '{}' ';'
3122 echo 'Removing unneeded directories:'
3124 files
=`find . -type d -print | sort -r`
3125 for file in $files; do
3126 rmdir $LIB/$file > /dev
/null
2>&1