From: drg@candidus.ma30.bull.com (Daniel R. Guilderson)
Subject: Re: Problems building GCC on SCO systems
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 16 Dec 1992 05:04:16 GMT

   From: smiley@akasha.eng.hou.compaq.com (Colin Smiley)
   Organization: Compaq Computer Corporation
   Date: Thu, 10 Dec 1992 21:23:49 GMT

   In article <9212071040.AA10051@noa.csrl.aoyama.ac.jp> rms@noa.csrl.aoyama.ac.jp (Richard Stallman) writes:

      There are problems building GCC on recent SCO systems.  Several people
      have found an apparent solution of defining STDC_VALUE as 0.  This
      appears to work, but it is actually incorrect because it causes GCC to
      define __STDC__ as 0 *all the time*.

      This is incorrect because GCC is supposed to handle __STDC__ the same
      way on all machines: namely, it should be 1.

   I then tried defining "X_CFLAGS = -DSTDC_VALUE=0".  This worked just
   fine and GCC compiled with a good result from "make compare".

I think RMS' explanation is pretty clear.  Defining STDC_VALUE to be 0
is not a good idea.  I think future versions of GCC will compile on
SCO 3.2v4 without any problems (at least I know the problems are being
worked on---actually I believe they are solved now).

Try this instead:

Date: Fri, 11 Dec 92 01:26:56 PST
From: ian (Ian Lance Taylor)
Subject: gcc ss-921205 on SCO 3.2v4 patch 1 of 2

Here is the first patch needed for gcc ss-921205 on SCO 3.2v4.

I had trouble building the compiler with rcc.  The cc compiler is much
better in 3.2v4, so I decided to use that.  The SCO compiler treats
enum bitfields as signed, so I had to define ONLY_INT_FIELDS as is
done for a few other hosts.  Then there was a bug in accessing the
code field in rtx_def, which I was able to correct by making it an
explicit bit field.  This may make access to this field slightly less
efficient for some compilers when ONLY_INT_FIELDS is defined, but I
don't think that is important, particularly since gcc need never
define it.

Note that the patch I sent out previously for rtl.h is wrong; I was
misled by the cc bug.

Fri Dec 11 00:13:52 1992  Ian Lance Taylor  (ian@cygnus.com)

	* x-i386s4: Don't use rcc.
	* xm-i386sco.h (ONLY_INT_FIELDS): Define.
	* rtl.h (rtx_def): Give bit field size for code field.

*** /sphagnum/usr/wilson/fsf/clean-ss-921205/config/x-i386s4	Sun Nov  1 06:55:03 1992
--- x-i386s4	Fri Dec 11 00:41:42 1992
***************
*** 1,9 ****
  RANLIB = :
  RANLIB_TEST = false
- CC = rcc $(RCCFLAGS)
- OLDCC = rcc $(RCCFLAGS)
- RCCFLAGS = -Dunix -Di386 -DM_UNIX -DM_I386 -DNULL=0
- CCLIBFLAGS =
  CLIB = -lPW
  
  # Seems to be needed with SCO DEV3.2v4.
--- 1,5 ----

*** /sphagnum/usr/wilson/fsf/clean-ss-921205/config/xm-i386sco.h	Fri May 15 03:58:06 1992
--- xm-i386sco.h	Fri Dec 11 00:41:49 1992
***************
*** 9,11 ****
--- 9,18 ----
  /* Big buffers improve performance.  */
  
  #define IO_BUFFER_SIZE (0x8000 - 1024)
+ 
+ #ifndef __GNUC__
+ /* The SCO compiler gets it wrong, and treats enumerated bitfields
+    as signed quantities, making it impossible to use an 8-bit enum
+    for compiling GNU C++.  */
+ #define ONLY_INT_FIELDS 1
+ #endif

*** /sphagnum/usr/wilson/fsf/clean-ss-921205/rtl.h	Mon Oct 26 03:05:24 1992
--- rtl.h	Fri Dec 11 00:42:05 1992
***************
*** 68,74 ****
  typedef struct rtx_def
  {
  #ifdef ONLY_INT_FIELDS
!   unsigned short code;
  #else
    /* The kind of expression this is.  */
    enum rtx_code code : 16;
--- 68,74 ----
  typedef struct rtx_def
  {
  #ifdef ONLY_INT_FIELDS
!   unsigned int code : 16;
  #else
    /* The kind of expression this is.  */
    enum rtx_code code : 16;

Date: Fri, 11 Dec 92 01:27:41 PST
From: ian (Ian Lance Taylor)
Subject: gcc ss-921205 on SCO 3.2v4 patch 2 of 2

Here is the second patch needed for gcc ss-921205 on SCO 3.2v4.

On SCO 3.2v4 we need to run the fixinc.svr4 script to fix the header
files.  The fixinc.svr4 script needs a few changes in order to do the
right thing.  SCO uses !__STDC__ in their header files, which must be
changed to !__STRICT_ANSI__.  The patch to getcwd doesn't match the
one in stdlib.h, and must be modified slightly.  I ran the modified
fixinc.svr4 on a Solaris 2 system and had no problems.

Fri Dec 11 00:13:52 1992  Ian Lance Taylor  (ian@cygnus.com)

	* configure (i[34]86-*-sco3.2v4*): Use fixinc.svr4.
	* fixinc.svr4: Turn !__STDC__ into !__STRICT_ANSI__.  Don't
	require space after getcwd argument in stdlib.h.

*** /sphagnum/usr/wilson/fsf/clean-ss-921205/configure	Fri Dec  4 17:02:55 1992
--- configure	Fri Dec 11 01:10:33 1992
***************
*** 335,340 ****
--- 335,341 ----
  		tm_file=i386sco4.h
  		xmake_file=x-i386s4
  		tmake_file=t-i386sco
+ 		fixincludes=fixinc.svr4
  		broken_install=yes
  		;;
  	i[34]86-*-sco*)		 	# 80386 running SCO system

*** /sphagnum/usr/wilson/fsf/clean-ss-921205/fixinc.svr4	Fri Nov 27 03:20:54 1992
--- fixinc.svr4	Fri Dec 11 00:42:00 1992
***************
*** 181,186 ****
--- 181,187 ----
  	  s/__STDC__ == 0/!defined (__STRICT_ANSI__)/g
  	  s/__STDC__ != 0/defined (__STRICT_ANSI__)/g
  	  s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g
+ 	  s/!__STDC__/!defined (__STRICT_ANSI__)/g
  	' $2/$file > $2/$file.sed
  	mv $2/$file.sed $2/$file
  	if cmp $file $2/$file >/dev/null 2>&1; then
*************** else
*** 207,213 ****
  fi
  if [ \! -z "$file_to_fix" ]; then
    echo Checking $file_to_fix
!   sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix > /tmp/$base
    if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
      echo No change needed in $file_to_fix
    else
--- 208,214 ----
  fi
  if [ \! -z "$file_to_fix" ]; then
    echo Checking $file_to_fix
!   sed -e 's/getcwd(char \{0,\}\*, int)/getcwd(char *, size_t)/' $file_to_fix > /tmp/$base
    if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
      echo No change needed in $file_to_fix
    else


Newsgroups: gnu.gcc.help