/usr/include/curses.h not fixed on sparc-sun-solaris2.5.1

Manfred Hollstein manfred@s-direktnet.de
Thu May 7 03:14:00 GMT 1998


On Wed, 6 May 1998, 14:00:10, wilson@cygnus.com wrote:

 > 	* fixinc.sol2: New file.
 > 	* configure.in (i[[34567]]86-*-solaris2*): Use it on Solaris >= 2.5.
 > 	(powerpcle-*-solaris2*): Likewise.
 > 	(sparc-*-solaris2*): Likewise.
 > 
 > This patch defeats Paul Eggert's attempts to make the gcc solaris2 port
 > OS version independent.

Ah yes, this  wasn't my  intention  of course.  But I thought  copying
"curses.h" would be  harmless; I  actually  don't know why Sun  should
change this file in newer releases ;-)

Anyway, not to  copy at all is the  better solution. I changed the way
curses.h is fixed similar to the way math.h is. May I check this in?

manfred

Thu May  7 11:41:37 1998  Manfred Hollstein  <manfred@s-direktnet.de>

	* fixinc.sol2: New file.
	* configure.in (i[[34567]]86-*-solaris2*): Use it on Solaris >= 2.5.
	(powerpcle-*-solaris2*): Likewise.
	(sparc-*-solaris2*): Likewise.

diff -rupN -x CVS egcs-19980507.orig/gcc/configure.in egcs-19980507/gcc/configure.in
--- egcs-19980507.orig/gcc/configure.in	Thu May  7 11:06:20 1998
+++ egcs-19980507/gcc/configure.in	Thu May  7 11:34:46 1998
@@ -1012,7 +1012,7 @@ for machine in $build $host $target; do
 		*-*-solaris2.[[0-4]])
 			fixincludes=fixinc.svr4;;
 		*)
-			fixincludes=fixinc.math;;
+			fixincludes=fixinc.sol2;;
 		esac
  		if [[ x$enable_threads = xyes ]]; then
 			thread_file='solaris'
@@ -2375,7 +2375,7 @@ for machine in $build $host $target; do
 		*-*-solaris2.[[0-4]])
 			fixincludes=fixinc.svr4;;
 		*)
-			fixincludes=fixinc.math;;
+			fixincludes=fixinc.sol2;;
 		esac
 		extra_headers=ppc-asm.h
 		;;
@@ -2526,7 +2526,7 @@ for machine in $build $host $target; do
 		*-*-solaris2.[[0-4]])
 			fixincludes=fixinc.svr4;;
 		*)
-			fixincludes=fixinc.math;;
+			fixincludes=fixinc.sol2;;
 		esac
 		float_format=i128
 		if [[ x${enable_threads} = x ]]; then
diff -rupN -x CVS egcs-19980507.orig/gcc/configure egcs-19980507/gcc/configure
--- egcs-19980507.orig/gcc/configure	Thu May  7 11:07:41 1998
+++ egcs-19980507/gcc/configure	Thu May  7 11:34:47 1998
@@ -2701,7 +2701,7 @@ for machine in $build $host $target; do
 		*-*-solaris2.[0-4])
 			fixincludes=fixinc.svr4;;
 		*)
-			fixincludes=fixinc.math;;
+			fixincludes=fixinc.sol2;;
 		esac
  		if [ x$enable_threads = xyes ]; then
 			thread_file='solaris'
@@ -4064,7 +4064,7 @@ for machine in $build $host $target; do
 		*-*-solaris2.[0-4])
 			fixincludes=fixinc.svr4;;
 		*)
-			fixincludes=fixinc.math;;
+			fixincludes=fixinc.sol2;;
 		esac
 		extra_headers=ppc-asm.h
 		;;
@@ -4215,7 +4215,7 @@ for machine in $build $host $target; do
 		*-*-solaris2.[0-4])
 			fixincludes=fixinc.svr4;;
 		*)
-			fixincludes=fixinc.math;;
+			fixincludes=fixinc.sol2;;
 		esac
 		float_format=i128
 		if [ x${enable_threads} = x ]; then
diff -rupN -x CVS egcs-19980507.orig/gcc/fixinc.sol2 egcs-19980507/gcc/fixinc.sol2
--- egcs-19980507.orig/gcc/fixinc.sol2	Thu Jan  1 02:00:00 1970
+++ egcs-19980507/gcc/fixinc.sol2	Thu May  7 11:41:23 1998
@@ -0,0 +1,84 @@
+#! /bin/sh
+# Fix struct exception in /usr/include/math.h.
+# Fix typedef bool in /usr/include/curses.h.
+#
+# This script is copied from fixinc.math and adds a fix for the broken
+# type definition in Solaris' curses.h.
+# See README-fixinc for more information.
+
+# Directory containing the original header files.
+# (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
+INPUT=${2-${INPUT-/usr/include}}
+
+# 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
+
+echo Building fixed headers in ${LIB}
+
+# Some math.h files define 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
+if [ -r $INPUT/$file ]; then
+  echo Checking $INPUT/$file
+  if grep 'struct exception' $INPUT/$file >/dev/null
+  then
+    echo Fixed $file
+    rm -f $LIB/$file
+    cat <<'__EOF__' >$LIB/$file
+#ifndef _MATH_H_WRAPPER
+#ifdef __cplusplus
+# define exception __math_exception
+#endif
+#include_next <math.h>
+#ifdef __cplusplus
+# undef exception
+#endif
+#define _MATH_H_WRAPPER
+#endif /* _MATH_H_WRAPPER */
+__EOF__
+    # Define _MATH_H_WRAPPER at the end of the wrapper, not the start,
+    # so that if #include_next gets another instance of the wrapper,
+    # this will follow the #include_next chain until we arrive at
+    # the real <math.h>.
+    chmod a+r $LIB/$file
+  fi
+fi
+
+# Avoid the definition of the bool type in the Solaris 2.x curses.h when using
+# g++, since it's now an official type in the C++ language.
+# Use the same fix as for math.h above.
+file=curses.h
+if [ -r $INPUT/$file ]; then
+  echo Checking $INPUT/$file
+  if egrep 'typedef[ 	][ 	]*char[ 	][ 	]*bool' $INPUT/$file >/dev/null
+  then
+    echo Fixed $file
+    rm -f $LIB/$file
+    cat <<'__EOF__' >$LIB/$file
+#ifndef _CURSES_H_WRAPPER
+#ifdef __cplusplus
+# define bool __curses_bool_t
+#endif
+#include_next <curses.h>
+#ifdef __cplusplus
+# undef bool
+#endif
+#define _CURSES_H_WRAPPER
+#endif /* _CURSES_H_WRAPPER */
+__EOF__
+    # Define _CURSES_H_WRAPPER at the end of the wrapper, not the start,
+    # so that if #include_next gets another instance of the wrapper,
+    # this will follow the #include_next chain until we arrive at
+    # the real <curses.h>.
+    chmod a+r $LIB/$file
+  fi
+fi
+
+exit 0



More information about the Gcc-bugs mailing list