home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pipex!bnr.co.uk!uknet!strath-cs!cen.ex.ac.uk!JRowe
- From: JRowe@cen.ex.ac.uk (J.Rowe)
- Newsgroups: comp.windows.x
- Subject: Making X11R5 on Convex
- Message-ID: <BzMEpx.J7y@cen.ex.ac.uk>
- Date: 21 Dec 92 17:46:45 GMT
- Sender: JRowe@cen.ex.ac.uk (J.Rowe)
- Distribution: comp.windows.x
- Organization: Computer Unit. - University of Exeter. UK
- Lines: 195
-
- A month or so ago I asked if anyone had managed to get X11R5 to
- compile on a Convex. Thanks for all the replies, this is how I did it.
-
- First, the problem. As far as I can tell ConvexOS comes with an
- amazing five (count 'em FIVE) c preprocessors, all with different
- bugs. There's /lib/cpp which seems to have no function other than to
- be documented in the man page. Then there's /usr/lib/cc/cpp which is
- the one that gets exec ed by cc if you do a cc - E. This can do
- either ANSI or K&R preprocessing. Of course, when you actually compile
- the code cc doesn't use this preprocessor! No, it has its own internal
- one, with its own bugs. Finally, Convex also ship a K&R only c
- compiler which lives in /usr/lib/pcc, I assume this has its own pair
- of preprocessors. (Gratuitous aside - would you by an OS with five c
- preprocessors?) The problem is string concatenation - they jus' don'
- do it right.
-
- Fortunately the technical guys are still very helpful when they are
- allowed to look at customers' problems and Richard Hargrove of Convex
- e-mailed me a patch to two files in the mit/config directory (patch
- follows at end of article). This didn't quite work using patch on my
- copy of X11R5 but since it was just two chunks of code it was trivial
- to edit the files by hand. This fixed the problems in whichever of the
- many versions of cpp that didn't work when trying to make the make
- files.
-
- Well, the make files made OK! But then some compilations barfed because
- the compiler's internal preprocessor wan't concatenating strings.
-
- So I wrote by own cc in perl (follows at end of article) and put it in
- /usr/local/bin/cc which comes first in by path. This tried a straight
- compile and, if that failed, stuck it through cc -E -pcc and then
- compiled the results. (The script actually tried up to four different
- preprocessors until one worked but I don't think it needed to go past
- the first). This made OK and as far as I know it WORKS.
-
- Major caveat - all I tried it on was emacs and xterm. There could be
- a million errors I don't know about, comments welcome.
-
- Incidently I had to chmod -x /usr/local/bin/make (gnu make) because it
- passes its internal variables via environmental variables. Convex CC
- takes notice of the value of CCOPTIONS you get stung.
-
- A couple of people said in e-mail that their system managers
- had managed to compile X11R5 themselves, they may have done a better
- job of it. If you want to ask them how they did it e-mail me and I
- will forward your request to them, it not being considered over
- ethical to quote private e-mail over the net.
-
- The final twist is that Convex UK decided to give me their version of
- X-windows, and CXWindows 3.0 is R5 anyway. Does this make Convex one
- of the first vendors to ship R5?
-
- Again, thanks to all those who replied.
-
- John
-
- Patch to files in mit/config:
-
- *** Project.tmpl Fri Nov 6 16:53:30 1992
- --- Project.tmpl.R5fixed Thu Nov 12 17:46:24 1992
- ***************
- *** 634,640 ****
- * exists to avoid problems with some preprocessors
- */
- #ifndef _UseCat
- ! #if (defined (__STDC__) || (defined(__convex__) && defined(__stdc__))) && !defined(UnixCpp)
- #ifdef UseInstalled
- #define _UseCat(a,b,c) a##c
- #else
- --- 634,640 ----
- * exists to avoid problems with some preprocessors
- */
- #ifndef _UseCat
- ! #if __STDC__ && !defined(UnixCpp)
- #ifdef UseInstalled
- #define _UseCat(a,b,c) a##c
- #else
- *** imake.c Mon Nov 9 15:55:34 1992
- --- imake.c.R5fixed Thu Nov 12 17:13:05 1992
- ***************
- *** 341,384 ****
- if (p = getenv("IMAKEMAKE"))
- make = p;
-
- - /*
- - * If we are running on the convex and we are using the Convex
- - * cpp, then we need to add the "-pcc" switch. This will keep
- - * the pre-processor from striping backslash-newlines.
- - */
- - # if defined(__convex__)
- - {
- - # include <sys/param.h> /* for MAXPATHLEN */
- - # define FLAGS "-vn -P" /* Flags to send to cpp */
- - # define STRING "CONVEX CPP" /* Uniquely identifies convex cpp */
- -
- - char cmd[MAXPATHLEN+sizeof(FLAGS)+20];
- - char buf [sizeof(STRING)];
- - FILE *fp;
- - char *old_cpp = cpp;
- -
- - /* %% jrh -- ensure cpp is non-NULL
- - */
- - if (cpp == (char *)0) cpp = DEFAULT_CPP;
- - sprintf(cmd, "%s %s < /dev/null 2>&1", cpp, FLAGS);
- - cpp = old_cpp;
- - if ((fp = popen(cmd, "r")) == NULL) {
- - LogFatalI("Cannot run %s to find version\n", cpp);
- - }
- - if (fread(buf, sizeof(STRING), 1, fp) < 0) {
- - LogFatal("Cannot read output from %s to find version\n", cpp);
- - }
- - if ( !strncmp(buf, STRING, sizeof(STRING)-1)) {
- - AddCppArg("-pcc");
- - }
- - (void) pclose(fp);
- -
- - #undef FLAGS
- - #undef STRING
- - }
- - # endif /* __convex__ */
- -
- -
- if (signal(SIGINT, SIG_IGN) != SIG_IGN)
- signal(SIGINT, catch);
- }
- --- 341,346 ----
-
-
- cc program (must come first in path):
-
- #! /usr/local/bin/perl
- # Caveat - this is a grunge it until it seems to work hack.
-
- open(LOGFILE, ">>/tmp/cclog") || die ("Cannot open logfile\n");
-
- # Protect special characters in args.
- foreach $n ( 0 .. $#ARGV ) {
- $ARGV[$n] =~ s/(\$|\\|\s|[]['"%!(){}])/\\\1/g;
- }
- $ccopts = join(' ', @ARGV);
- print LOGFILE $ccopts;
- `/bin/cc $ccopts`;
- if ( $? == 0 ) {
- print LOGFILE " OK\n";
- exit;
- }
-
- # OK, lets bodge it.
- print STDERR "Trying bodge...\n";
- print LOGFILE ':: trying: ';
- while ( $opt = shift ) {
- if ( $opt =~ /^-[IDU]/ ) {
- $opts .= "$opt ";
- }
- elsif ( $opt =~ /\.c$/ ) {
- if ( $cfile ) {
- die(": Two .c files specified\n");
- }
- else {
- $cfile = $opt;
- }
- }
- }
-
- if ( ! $cfile ) {
- die(": No .c file specified.\n");
- }
- $backfile = 'JMR'.$cfile;
- print LOGFILE " > $opts , backup: $backfile";
- if ( ! -e $backfile ) {
- `/bin/cp -p $cfile $backfile`;
- if ( $? != 0 ) {
- print LOGFILE " backup FAILED\n";
- die("Backup failed.\n");
- }
- }
-
- foreach $cpp ( '/bin/cc -E -pcc', '/lib/cpp -pcc', '/usr/lib/pcc/cpp', 'gcpp -traditional -D__convex__' ) {
- print LOGFILE " $cpp: ";
- print STDERR "Trying $cpp\n";
- `$cpp -DUNIXCPP -P $opts $backfile > $cfile`;
-
- `/bin/cc $ccopts`;
- $stat = $?;
- `/bin/cp -p $cfile JMR_last_c_file`;
- `/bin/cp -p $backfile $cfile`;
- if ( $stat == 0 ) {
- print LOGFILE " OK\n";
- print STDERR " bodge seemed to work OK\n";
- exit;
- }
- }
-
- print LOGFILE " FAILED!!\n";
- exit 1;
-