2 # Install modified versions of certain problematic Irix include files.
3 # Copyright (C) 1997 Free Software Foundation, Inc.
4 # Contributed by Brendan Kehoe (brendan@cygnus.com).
6 # This file is part of GNU CC.
8 # GNU CC is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # GNU CC is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU CC; see the file COPYING. If not, write to
20 # the Free Software Foundation, 59 Temple Place - Suite 330,
21 # Boston, MA 02111-1307, USA.
23 # See README-fixinc for more information.
25 # Directory containing the original header files.
26 INPUT
=${2-${INPUT-/usr/include}}
28 # Fail if no arg to specify a directory for the output.
30 then echo fixincludes
: no output directory specified
34 # Directory in which to store the results.
35 LIB
=${1?"fixincludes: output directory not specified"}
37 # Make sure it exists.
38 if [ ! -d $LIB ]; then
44 # Make LIB absolute if it is relative.
45 # Don't do this if not necessary, since may screw up automounters.
54 echo 'Building fixincludes in ' ${LIB}
57 # Note: For Irix, we deliberately don't try to create the directory trees,
58 # since we only modify math.h, limits.h and unistd.h. If we
59 # ADD ANY OTHERS, the "Making directories:" and symlinks code from
60 # fixinc.svr4 may have to go back in.
62 # The Irix math.h defines struct exception, which conflicts with
63 # the class exception defined in the C++ file std/stdexcept.h. We
64 # redefine it to __math_exception. This is not a great fix, but I
65 # haven't been able to think of anything better.
68 if [ -r ${LIB}/$file ]; then
69 file_to_fix
=${LIB}/$file
71 if [ -r ${INPUT}/$file ]; then
72 file_to_fix
=${INPUT}/$file
77 if [ \
! -z "$file_to_fix" ]; then
78 echo Checking
$file_to_fix
79 sed -e '/struct exception/i\
81 #define exception __math_exception\
83 -e '/struct exception/a\
86 #endif' $file_to_fix > /tmp
/$base
87 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
90 echo Fixed
$file_to_fix
92 cp /tmp
/$base ${LIB}/$file
93 chmod a
+r
${LIB}/$file
98 # In limits.h, put #ifndefs around things that are supposed to be defined
99 # in float.h to avoid redefinition errors if float.h is included first.
102 base
=`basename $file`
103 if [ -r ${LIB}/$file ]; then
104 file_to_fix
=${LIB}/$file
106 if [ -r ${INPUT}/$file ]; then
107 file_to_fix
=${INPUT}/$file
112 if [ \
! -z "$file_to_fix" ]; then
113 echo Checking
$file_to_fix
114 sed -e '/[ ]FLT_MIN[ ]/i\
117 -e '/[ ]FLT_MIN[ ]/a\
120 -e '/[ ]FLT_MAX[ ]/i\
123 -e '/[ ]FLT_MAX[ ]/a\
126 -e '/[ ]FLT_DIG[ ]/i\
129 -e '/[ ]FLT_DIG[ ]/a\
132 -e '/[ ]DBL_MIN[ ]/i\
135 -e '/[ ]DBL_MIN[ ]/a\
138 -e '/[ ]DBL_MAX[ ]/i\
141 -e '/[ ]DBL_MAX[ ]/a\
144 -e '/[ ]DBL_DIG[ ]/i\
147 -e '/[ ]DBL_DIG[ ]/a\
149 ' $file_to_fix > /tmp
/$base
150 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
153 echo Fixed
$file_to_fix
155 cp /tmp
/$base ${LIB}/$file
156 chmod a
+r
${LIB}/$file
161 # The Irix unistd.h will introduce a call to __vfork in its libc, but the
162 # function is never actually prototyped.
164 base
=`basename $file`
165 if [ -r ${LIB}/$file ]; then
166 file_to_fix
=${LIB}/$file
168 if [ -r ${INPUT}/$file ]; then
169 file_to_fix
=${INPUT}/$file
174 if [ \
! -z "$file_to_fix" ]; then
175 echo Checking
$file_to_fix
177 extern pid_t __vfork(void);'\
178 $file_to_fix > /tmp
/$base
179 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
182 echo Fixed
$file_to_fix
184 cp /tmp
/$base ${LIB}/$file
185 chmod a
+r
${LIB}/$file