Commit 1d3337fc by Jim Wilson Committed by Jim Wilson

Avoid irix 6.2/irix 6.3 header file conflict.

	* fixinc.irix (math.h): Install wrapper instead of copying.

From-SVN: r21339
parent 2491f72d
Wed Jul 22 12:47:49 1998 Jim Wilson <wilson@cygnus.com>
* fixinc.irix (math.h): Install wrapper instead of copying.
Wed Jul 22 12:37:14 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> Wed Jul 22 12:37:14 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
* tree.def (EXPR_WITH_FILE_LOCATION): Defined as an 'e' expression * tree.def (EXPR_WITH_FILE_LOCATION): Defined as an 'e' expression
......
#! /bin/sh #! /bin/sh
# Install modified versions of certain problematic Irix include files. # Install modified versions of certain problematic Irix include files.
# If possible, create a wrapper (see fixinc.wrap) instead of copying files.
#
# Copyright (C) 1997 Free Software Foundation, Inc. # Copyright (C) 1997 Free Software Foundation, Inc.
# Contributed by Brendan Kehoe (brendan@cygnus.com). # Contributed by Brendan Kehoe (brendan@cygnus.com).
# #
...@@ -59,40 +61,40 @@ echo 'Building fixincludes in ' ${LIB} ...@@ -59,40 +61,40 @@ echo 'Building fixincludes in ' ${LIB}
# ADD ANY OTHERS, the "Making directories:" and symlinks code from # ADD ANY OTHERS, the "Making directories:" and symlinks code from
# fixinc.svr4 may have to go back in. # fixinc.svr4 may have to go back in.
# The Irix math.h defines struct exception, which conflicts with # This math.h fix is copied from fixinc.wrap. We want to avoid copying
# math.h because both math.h and stdlib.h have a declaration for initstate,
# and this declaration changed between Irix 6.2 and Irix 6.3. If we copy this
# file, then the same toolchain can't be shared between 6.2 and 6.3+.
# Some math.h files define struct exception, which conflicts with
# the class exception defined in the C++ file std/stdexcept.h. We # 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 # redefine it to __math_exception. This is not a great fix, but I
# haven't been able to think of anything better. # haven't been able to think of anything better.
file=math.h file=math.h
base=`basename $file` if [ -r $INPUT/$file ]; then
if [ -r ${LIB}/$file ]; then echo Checking $INPUT/$file
file_to_fix=${LIB}/$file if grep 'struct exception' $INPUT/$file >/dev/null
else then
if [ -r ${INPUT}/$file ]; then echo Fixed $file
file_to_fix=${INPUT}/$file rm -f $LIB/$file
else cat <<'__EOF__' >$LIB/$file
file_to_fix="" #ifndef _MATH_H_WRAPPER
fi #ifdef __cplusplus
fi # define exception __math_exception
if [ \! -z "$file_to_fix" ]; then #endif
echo Checking $file_to_fix #include_next <math.h>
sed -e '/struct exception/i\ #ifdef __cplusplus
#ifdef __cplusplus\ # undef exception
#define exception __math_exception\ #endif
#endif'\ #define _MATH_H_WRAPPER
-e '/struct exception/a\ #endif /* _MATH_H_WRAPPER */
#ifdef __cplusplus\ __EOF__
#undef exception\ # Define _MATH_H_WRAPPER at the end of the wrapper, not the start,
#endif' $file_to_fix > /tmp/$base # so that if #include_next gets another instance of the wrapper,
if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ # this will follow the #include_next chain until we arrive at
true # the real <math.h>.
else chmod a+r $LIB/$file
echo Fixed $file_to_fix
rm -f ${LIB}/$file
cp /tmp/$base ${LIB}/$file
chmod a+r ${LIB}/$file
fi fi
rm -f /tmp/$base
fi fi
# In limits.h, put #ifndefs around things that are supposed to be defined # In limits.h, put #ifndefs around things that are supposed to be defined
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment