aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Kehoe <brendan@gcc.gnu.org>1997-02-12 16:08:06 -0500
committerBrendan Kehoe <brendan@gcc.gnu.org>1997-02-12 16:08:06 -0500
commit2ed0847f87cc8954822911d4f05ef0d324307935 (patch)
tree4c9000576fbb2913461b8935296b7e2f32b1fe43
parentc92ca24128fdead668c7cbbe926afdfd0943ddc3 (diff)
downloadgcc-2ed0847f87cc8954822911d4f05ef0d324307935.zip
gcc-2ed0847f87cc8954822911d4f05ef0d324307935.tar.gz
gcc-2ed0847f87cc8954822911d4f05ef0d324307935.tar.bz2
Initial revision
From-SVN: r13632
-rwxr-xr-xgcc/fixinc.irix161
1 files changed, 161 insertions, 0 deletions
diff --git a/gcc/fixinc.irix b/gcc/fixinc.irix
new file mode 100755
index 0000000..2220977
--- /dev/null
+++ b/gcc/fixinc.irix
@@ -0,0 +1,161 @@
+#! /bin/sh
+# Install modified versions of certain problematic Irix include files.
+# Copyright (C) 1997 Free Software Foundation, Inc.
+# Contributed by Brendan Kehoe (brendan@cygnus.com).
+#
+# This file is part of GNU CC.
+#
+# GNU CC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU CC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU CC; see the file COPYING. If not, write to
+# the Free Software Foundation, 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+# See README-fixinc for more information.
+
+# Directory containing the original header files.
+INPUT=${2-${INPUT-/usr/include}}
+
+# Fail if no arg to specify a directory for the output.
+if [ x$1 = x ]
+then echo fixincludes: no output directory specified
+exit 1
+fi
+
+# Directory in which to store the results.
+LIB=${1?"fixincludes: output directory not specified"}
+
+# Make sure it exists.
+if [ ! -d $LIB ]; then
+ mkdir $LIB || exit 1
+fi
+
+ORIG_DIR=`pwd`
+
+# Make LIB absolute if it is relative.
+# Don't do this if not necessary, since may screw up automounters.
+case $LIB in
+/*)
+ ;;
+*)
+ LIB=$ORIG_DIR/$LIB
+ ;;
+esac
+
+echo 'Building fixincludes in ' ${LIB}
+
+#
+# Note: For Irix, we deliberately don't try to create the directory trees,
+# since we only modify math.h and limits.h. If we ADD ANY OTHERS,
+# the "Making directories:" and symlinks code from fixinc.svr4 may
+# have to go back in.
+
+# The Irix math.h defines struct exception, which conflicts with
+# the class exception defined in the C++ file std/stdexcept.h. We
+# redefine it to __math_exception. This is not a great fix, but I
+# haven't been able to think of anything better.
+file=math.h
+base=`basename $file`
+if [ -r ${LIB}/$file ]; then
+ file_to_fix=${LIB}/$file
+else
+ if [ -r ${INPUT}/$file ]; then
+ file_to_fix=${INPUT}/$file
+ else
+ file_to_fix=""
+ fi
+fi
+if [ \! -z "$file_to_fix" ]; then
+ echo Checking $file_to_fix
+ sed -e '/struct exception/i\
+#ifdef __cplusplus\
+#define exception __math_exception\
+#endif'\
+ -e '/struct exception/a\
+#ifdef __cplusplus\
+#undef exception\
+#endif' $file_to_fix > /tmp/$base
+ if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
+ true
+ else
+ echo Fixed $file_to_fix
+ rm -f ${LIB}/$file
+ cp /tmp/$base ${LIB}/$file
+ chmod a+r ${LIB}/$file
+ fi
+ rm -f /tmp/$base
+fi
+
+# In limits.h, put #ifndefs around things that are supposed to be defined
+# in float.h to avoid redefinition errors if float.h is included first.
+
+file=limits.h
+base=`basename $file`
+if [ -r ${LIB}/$file ]; then
+ file_to_fix=${LIB}/$file
+else
+ if [ -r ${INPUT}/$file ]; then
+ file_to_fix=${INPUT}/$file
+ else
+ file_to_fix=""
+ fi
+fi
+if [ \! -z "$file_to_fix" ]; then
+ echo Checking $file_to_fix
+ sed -e '/[ ]FLT_MIN[ ]/i\
+#ifndef FLT_MIN
+'\
+ -e '/[ ]FLT_MIN[ ]/a\
+#endif
+'\
+ -e '/[ ]FLT_MAX[ ]/i\
+#ifndef FLT_MAX
+'\
+ -e '/[ ]FLT_MAX[ ]/a\
+#endif
+'\
+ -e '/[ ]FLT_DIG[ ]/i\
+#ifndef FLT_DIG
+'\
+ -e '/[ ]FLT_DIG[ ]/a\
+#endif
+'\
+ -e '/[ ]DBL_MIN[ ]/i\
+#ifndef DBL_MIN
+'\
+ -e '/[ ]DBL_MIN[ ]/a\
+#endif
+'\
+ -e '/[ ]DBL_MAX[ ]/i\
+#ifndef DBL_MAX
+'\
+ -e '/[ ]DBL_MAX[ ]/a\
+#endif
+'\
+ -e '/[ ]DBL_DIG[ ]/i\
+#ifndef DBL_DIG
+'\
+ -e '/[ ]DBL_DIG[ ]/a\
+#endif
+' $file_to_fix > /tmp/$base
+ if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
+ true
+ else
+ echo Fixed $file_to_fix
+ rm -f ${LIB}/$file
+ cp /tmp/$base ${LIB}/$file
+ chmod a+r ${LIB}/$file
+ fi
+ rm -f /tmp/$base
+fi
+
+exit 0