From xemacs-m  Sun Jan 12 15:58:54 1997
Received: from venus.Sun.COM (venus.Sun.COM [192.9.25.5])
          by xemacs.org (8.8.4/8.8.4) with SMTP
	  id PAA01640 for <xemacs-beta@xemacs.org>; Sun, 12 Jan 1997 15:58:53 -0600 (CST)
Received: from Eng.Sun.COM ([129.146.1.25]) by venus.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id NAA29318; Sun, 12 Jan 1997 13:58:22 -0800
Received: from kindra.eng.sun.com by Eng.Sun.COM (SMI-8.6/SMI-5.3)
	id NAA08891; Sun, 12 Jan 1997 13:58:20 -0800
Received: from xemacs.eng.sun.com by kindra.eng.sun.com (SMI-8.6/SMI-SVR4)
	id NAA27678; Sun, 12 Jan 1997 13:58:18 -0800
Received: by xemacs.eng.sun.com (SMI-8.6/SMI-SVR4)
	id NAA17642; Sun, 12 Jan 1997 13:58:16 -0800
Date: Sun, 12 Jan 1997 13:58:16 -0800
Message-Id: <199701122158.NAA17642@xemacs.eng.sun.com>
From: Martin Buchholz <mrb@Eng.Sun.COM>
To: Karel Zuiderveld <Karel.Zuiderveld@cv.ruu.nl>
Cc: xemacs-beta@xemacs.org
Subject: Re: SGI's and cpp
In-Reply-To: <199701111054.LAA18295@wodan.cv.ruu.nl>
References: <199701110824.AAA29475@xemacs.eng.sun.com>
	<199701111054.LAA18295@wodan.cv.ruu.nl>
Reply-To: Martin Buchholz <mrb@Eng.Sun.COM>
Mime-Version: 1.0 (generated by tm-edit 7.100)
Content-Type: text/plain; charset=US-ASCII

>>>>> "Karel" == Karel Zuiderveld <Karel.Zuiderveld@cv.ruu.nl> writes:

>> 
>> To SGI users: please rescue your platform as follows:
Karel> ...

>> So if cc is your C compiler, try:
>> export CPP='cc -E'
>> configure
>> make
Karel> This solves the configuration problem. 

Good.

Karel> ....
>> BTW, I notice in configure the section for SGI's is as follows:
>> 
>> ## Silicon Graphics machines
>> ## Iris 2500 and Iris 2500 Turbo (aka the Iris 3030)
>> m68*-sgi-iris3.5* ) machine=irist opsys=iris3-5 ;;
>> m68*-sgi-iris3.6* | m68*-sgi-iris*) machine=irist opsys=iris3-6 ;;
>> ## Iris 4D
>> mips-sgi-irix3.*      ) machine=iris4d opsys=irix3-3 ;;
>> mips-sgi-irix4.*      ) machine=iris4d opsys=irix4-0 ;;
>> mips-sgi-irix6*       ) machine=iris4d opsys=irix6-0  NON_GNU_CPP=/lib/cpp ;;
>> mips-sgi-irix5.[3-9]* ) machine=iris4d opsys=irix5-3 ;;
>> mips-sgi-irix5.2*     ) machine=iris4d opsys=irix5-2 ;;
>> mips-sgi-irix5.1*     ) machine=iris4d opsys=irix5-1 ;;
>> mips-sgi-irix*        ) machine=iris4d opsys=irix5-0 ;;
>> 
>> Where did the setting for NON_GNU_CPP just for irix6 come from??
>> Could simply removing that assignment for NON_GNU_CPP above fix the
>> problem, by getting configure to use cc -E ?
>> 
>> SGI'ers, please investigate.

Karel> Editing the line

Karel> mips-sgi-irix6*       ) machine=iris4d opsys=irix6-0  NON_GNU_CPP="cc -E" ;;

Fantastic.

Karel> as you suggested also solves the problem. But: I think that setting
Karel> the environment variable is the best solution, otherwise you run into
Karel> problems with systems that only have gcc.  

I disagree.  I think the way things work is that if you use gcc, then
configure will use `gcc -E' by default.  If you use cc, it will use
$NON_GNU_CPP by default, or if that is not defined, `cc -E'.  So just
removing that assignment to NON_GNU_CPP looks like The Fix.

Steve, can you make this change to configure.in ?

Karel> Also note that this fixes only 1 of the 3 problems I encountered;
Karel> the other two (configure doesn't find the X11 libs without setting
Karel> SGI_ABI to "-o32" and the presence of SGi specific jpeg/tiff/png
Karel> libraries that lead to core dumps) are tricky...

This problem is tougher than the previous one, and someone with SGI
access is going to have to futz around with configure to test for X
libraries on SGI correctly.  You'll have to get a copy of
autoconf-1.11 (ftp://ftp.xemacs.org/pub/beta/aux) to do a proper job.

There *is* supoport in src/Makefile.in.in for an alternate linker:

#ifdef ORDINARY_LINK
LD = $(CC) $(CFLAGS)
#else
#ifdef COFF_ENCAPSULATE
LD=$(CC) -nostdlib
#else /* not ORDINARY_LINK */
#ifdef LINKER
LD=LINKER
#else /* ! defined (LINKER) */
LD=ld
#endif /* ! defined (LINKER) */
#endif /* ! defined (COFF_ENCAPSULATE) */
#endif /* not ORDINARY_LINK */

So it is possible to link with a C++ compiler driver.  This is tricky
to get right without breaking support for older SGI OSes, gcc, or
other platforms.  

One last hint:  look at src/s/iris*.h m/sgi*.h (I haven't).

Good Luck!

Martin

