(*zeroextract[qs]i_compare0_scratch): Use const_int_operand
[official-gcc.git] / gcc / fixinc.ptx
blobd66998dd17a19d65241f6e3f46f4941bd4a5d4ee
1 #! /bin/sh
2 # Install modified versions of certain ANSI-incompatible
3 # native Sequent DYNIX/ptx System V Release 3.2 system include files.
4 # Copyright (C) 1994, 1996 Free Software Foundation, Inc.
5 # Contributed by Bill Burton <billb@progress.com>
6 # Portions adapted from fixinc.svr4 and fixincludes.
8 # This file is part of GNU CC.
9 #
10 # GNU CC is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2, or (at your option)
13 # any later version.
15 # GNU CC is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with GNU CC; see the file COPYING. If not, write to
22 # the Free Software Foundation, 59 Temple Place - Suite 330,
23 # Boston, MA 02111-1307, USA.
25 # This script munges the native include files provided with DYNIX/ptx
26 # so as to remove things which are violations of the ANSI C standard.
27 # This is done by first running fixinc.svr4 which does most of the
28 # work. A few includes have fixes made to them afterwards by this
29 # script. Once munged, the resulting new system include files are
30 # placed in a directory that GNU C will search *before* searching the
31 # /usr/include directory. This script should work properly for most
32 # DYNIX/ptx systems. For other types of systems, you should use the
33 # `fixincludes' script instead.
35 # See README-fixinc for more information.
37 # Directory containing the original header files.
38 INPUT=${2-${INPUT-/usr/include}}
40 # Fail if no arg to specify a directory for the output.
41 if [ x$1 = x ]
42 then echo fixincludes: no output directory specified
43 exit 1
46 # Directory in which to store the results.
47 LIB=${1?"fixincludes: output directory not specified"}
49 # Make sure it exists.
50 if [ ! -d $LIB ]; then
51 mkdir $LIB || exit 1
54 ORIG_DIR=`pwd`
56 # Make LIB absolute if it is relative.
57 # Don't do this if not necessary, since may screw up automounters.
58 case $LIB in
59 /*)
62 LIB=$ORIG_DIR/$LIB
64 esac
66 echo 'Running fixinc.svr4'
67 # DYNIX/ptx has dirname so this is no problem
68 `dirname $0`/fixinc.svr4 $*
69 echo 'Finished fixinc.svr4'
71 echo 'Building fixincludes in ' ${LIB}
73 # Copied from fixincludes.
74 # Don't use or define the name va_list in stdio.h.
75 # This is for ANSI and also to interoperate properly with gcc's varargs.h.
76 file=stdio.h
77 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
78 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
79 chmod +w ${LIB}/$file 2>/dev/null
80 chmod a+r ${LIB}/$file 2>/dev/null
83 if [ -r ${LIB}/$file ]; then
84 echo Fixing $file, use of va_list
85 # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
86 (echo "#define __need___va_list"
87 echo "#include <stdarg.h>") > ${LIB}/${file}.sed
88 # Use __gnuc_va_list in arg types in place of va_list.
89 # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
90 # trailing parentheses and semicolon save all other systems from this.
91 # Define __va_list__ (something harmless and unused) instead of va_list.
92 # Don't claim to have defined va_list.
93 sed -e 's@ va_list @ __gnuc_va_list @' \
94 -e 's@ va_list)@ __gnuc_va_list)@' \
95 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
96 -e 's@ va_list@ __va_list__@' \
97 -e 's@\*va_list@*__va_list__@' \
98 -e 's@ __va_list)@ __gnuc_va_list)@' \
99 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
100 -e 's@VA_LIST@DUMMY_VA_LIST@' \
101 -e 's@_NEED___Va_LIST@_NEED___VA_LIST@' \
102 ${LIB}/$file >> ${LIB}/${file}.sed
104 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
105 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
106 rm -f ${LIB}/$file
110 # In pwd.h, PTX 1.x needs stdio.h included since FILE * was added in a
111 # prototype later on in the file.
112 file=pwd.h
113 base=`basename $file`
114 if [ -r ${LIB}/$file ]; then
115 file_to_fix=${LIB}/$file
116 else
117 if [ -r ${INPUT}/$file ]; then
118 file_to_fix=${INPUT}/$file
119 else
120 file_to_fix=""
123 if [ \! -z "$file_to_fix" ]; then
124 echo Checking $file_to_fix
125 if grep stdio $file_to_fix > /dev/null; then
126 true
127 else
128 sed -e '/#include \<sys\types\.h\>/a\
130 #if defined(__STDC__) || defined(__cplusplus)\
131 #include <stdio.h>\
132 #endif /* __STDC__ */' \
133 $file_to_fix > ${LIB}/${file}.sed
134 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
135 echo Fixed $file_to_fix
139 # Copied from fixincludes.
140 # math.h puts the declaration of matherr before the definition
141 # of struct exception, so the prototype (added by fixproto) causes havoc.
142 file=math.h
143 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
144 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
145 chmod +w ${LIB}/$file 2>/dev/null
146 chmod a+r ${LIB}/$file 2>/dev/null
149 if [ -r ${LIB}/$file ]; then
150 echo Fixing $file, matherr declaration
151 sed -e '/^struct exception/,$b' \
152 -e '/matherr/i\
153 struct exception;
155 ${LIB}/$file > ${LIB}/${file}.sed
156 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
157 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
158 rm -f ${LIB}/$file
162 # In netinet/in.h, the network byte swapping asm functions supported by the
163 # native cc compiler on PTX 1.x and 2.x is not supported in gcc. Instead,
164 # include <sys/byteorder.h> written out by the fixinc.svr4 script which has
165 # these same routines written in an asm format supported by gcc.
166 file=netinet/in.h
167 base=`basename $file`
168 if [ -r ${LIB}/$file ]; then
169 file_to_fix=${LIB}/$file
170 else
171 if [ -r ${INPUT}/$file ]; then
172 file_to_fix=${INPUT}/$file
173 else
174 file_to_fix=""
177 if [ \! -z "$file_to_fix" ]; then
178 echo Checking $file_to_fix
179 if grep __GNUC__ $file_to_fix > /dev/null; then
180 true
181 else
182 sed -e '/#define NETSWAP/a\
184 #if defined (__GNUC__) || defined (__GNUG__)\
185 #include <sys/byteorder.h>\
186 #else /* not __GNUC__ */\
188 -e '/#endif[ ]*\/\* NETSWAP \*\//i\
189 #endif /* not __GNUC__ */' \
190 $file_to_fix > ${LIB}/${file}.sed
191 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
192 echo Fixed $file_to_fix
196 # /usr/include/sys/mc_param.h has an embedded asm for the cpuid intruction
197 # on the P5. This is not used by anything else so we ifdef it out.
198 file=sys/mc_param.h
199 if [ -r ${LIB}/$file ]; then
200 file_to_fix=${LIB}/$file
201 else
202 if [ -r ${INPUT}/$file ]; then
203 file_to_fix=${INPUT}/$file
204 else
205 file_to_fix=""
208 if [ \! -z "$file_to_fix" ]; then
209 echo Checking $file_to_fix
210 if grep __GNUC__ $file_to_fix > /dev/null; then
211 true
212 else
213 sed -e '/__asm/,/}/{
214 /__asm/i\
215 #if !defined (__GNUC__) && !defined (__GNUG__)
216 /}/a\
217 #endif
218 }' \
219 $file_to_fix > ${LIB}/${file}.sed
220 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
221 echo Fixed $file_to_fix
225 # /usr/include/sys/mc_param.h has an embedded asm for the cpuid intruction
226 # on the P5. This is not used by anything else so we ifdef it out.
227 file=sys/mc_param.h
228 if [ -r ${LIB}/$file ]; then
229 file_to_fix=${LIB}/$file
230 else
231 if [ -r ${INPUT}/$file ]; then
232 file_to_fix=${INPUT}/$file
233 else
234 file_to_fix=""
237 if [ \! -z "$file_to_fix" ]; then
238 echo Checking $file_to_fix
239 if grep __GNUC__ $file_to_fix > /dev/null; then
240 true
241 else
242 sed -e '/__asm/,/}/{
243 /__asm/i\
244 #if !defined (__GNUC__) && !defined (__GNUG__)
245 /}/a\
246 #endif
247 }' \
248 $file_to_fix > ${LIB}/${file}.sed
249 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
250 echo Fixed $file_to_fix
254 exit 0