[comp.windows.x] Can't build qdss on VAX under Ultrix 4.X

oneill@bass.bu.edu (Brian V O'Neill) (12/19/90)

This may have gone around before, but I have a problem building the color
server on a DEC VAX under Ultrix 4.X. When it attempts to build Xqdss, it
fails in qdss_io.c, on line 676 with "g undefined". An inspection of the
line shows it is an ioctl call:

	ioctl(fd_qdss, SG_VIDEOON, &Sg);

It appears to be failing in the last parameter, but I don't see why it is
ignoring the S. i also cannot find SG_VIDEOON defined anywhere. Likewise, it
fails on line 683, which is the same call with SG_VIDEOOFF. As near as I can
tell this is for the screen saver. Both lines are the "else" part of an if
statement, whose condition is "(!Vaxstar)". Is it safe to assume that if I'm
not compiling on a Vaxstar (or VS2000), I could temporarily remove these
lines? Are there any other solutions?

--
============================================================================
Brian O'Neill - Local Internet Access Account
Internet: oneill@bu-pub.bu.edu
UUCP    : ...!bu.edu!bu-pub!oneill

lriffe@triton.unm.edu (Larry Riffe II) (12/20/90)

Brian,
	There is indeed a problem with the 2 lines you mention, but
	the problem is not with the third variable, its with the second.

	It appears that this is not caused so much by a bug but more
	by changes DEC made to their OS that MIT doesn't know about.

	Follow along and I'll explain:

	In mit/server/ddx/dec/qdss/qdss_io.c we have the following lines:

	if (on != SCREEN_SAVER_ON)
	{
	   lastEventTime = GetTimeInMillis();
	   if (!Vaxstar)
	      *(short *) Qdss.memcsr = UNBLANK | SYNC_ON;
	   else
	      ioctl(fd_qdss, SG_VIDEOON, &Sg);            /* <= ERRORS HERE */
	}
	else
	{
	   if (!Vaxstar)
	      *(short *) Qdss.memcsr = SYNC_ON;
	   else
	      ioctl(fd_qdss, SG_VIDEOOFF, &Sg);           /* <= ERRORS HERE */
	}

	With the errors you mentioned occurring on the lines that are
	pointed to.

	In mit/server/ddx/dec/qdss/libtl/tl.h we have:

#ifdef __STDC__
#define SG_MAPDEVICE  _IOR('g', 9, struct sgmap) /* map device to user */
#define SG_VIDEOON    _IO('g',23)             /* turn on the video */
#define SG_VIDEOOFF   _IO('g',24)             /* turn off the video */
#define SG_CURSORON   _IO('g',25)             /* turn on the cursor */
#define SG_CURSOROFF  _IO('g',26)             /* turn off the cursor */
#else
#define SG_MAPDEVICE  _IOR(g, 9, struct sgmap) /* map device to user */
#define SG_VIDEOON    _IO(g,23)             /* turn on the video */
#define SG_VIDEOOFF   _IO(g,24)             /* turn off the video */
#define SG_CURSORON   _IO(g,25)             /* turn on the cursor */
#define SG_CURSOROFF  _IO(g,26)             /* turn off the cursor */
#endif

	And this is where the problem happens!  The variable __STDC__
	is supposed to be defined as 1 if the C compiler is ANSI C
	compliant!  DEC's is not and thus this defines the second set
	of variables instead of the first set.

	Now _IO is defined in /usr/include/sys/ioctl.h!  And DEC decided
	to change this definition between Ultrix 3.1 and 4.0.  Thus 
	causing the problem your having.  

	Ultrix 3.1 /usr/include/sys/ioctl.h:

		#define _IO(x,y)        (int)(IOC_VOID|('x'<<8)|y)

	And Ultrix 4.0 /usr/include/sys/ioctl.h:

		#define _IO(x,y)        (int)(_IOC_VOID|(x<<8)|y)


	If you notice, there are no ' around the x variable.  So, that
	means we have to define our original variables (the ones from
	/mit/server/ddx/dec/qdss/libtl/tl.h) as if we are using an ANSI
	C compliant compiler.  But, since we are not using an ANSI C
	compliant compiler (I've heard that DEC is working on this,
	but so far, their C compiler is not) we get an error and the
	color X server doesn't build for a VAX arch. machine.

	So, the question is how to fix this.  I've come up with two 
	methods, the first I don't know how to implement and the second
	which is a hack but does happen to work.

	The first method involves modifying the imakefile so that it
	will compile all of the source code in mit/server/ddx/dec/qdss
	with the option -DOSMajorVersion=???.  Then change the #ifdef
	in mit/server/ddx/dec/qdss/libtl/tl.h to look like:

	#if ( (__STDC__) || ( OSMajorVersion > 3 ) )

	The only problem with this, is that I don't know how to modify
	the imakefile to compile everything with the option I specified
	above!  Is there anybody out there who can tell me what needs
	to be changed to do this?

	The second method is a hack, I don't like it, but it's quick
	and it works.  The first thing is to make a backup copy of
	mit/server/ddx/dec/qdss/libtl/tl.h.  Then edit the copy in
	your source tree so that there is no longer a #ifdef and you
	only define the correct variables.  i.e.

#define SG_MAPDEVICE  _IOR('g', 9, struct sgmap) /* map device to user */
#define SG_VIDEOON    _IO('g',23)             /* turn on the video */
#define SG_VIDEOOFF   _IO('g',24)             /* turn off the video */
#define SG_CURSORON   _IO('g',25)             /* turn on the cursor */
#define SG_CURSOROFF  _IO('g',26)             /* turn off the cursor */

	Make sure you keep a backup copy of this file so that you can
	put it back in place after you have compiled the server code.

					Hope this helps,

						Larry G. Riffe II
						lriffe@triton.unm.edu
						lriffe@triton.cirt.unm.edu