From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 19-APR-1994 11:55:32.37
To:	EVERHART
CC:	
Subj:	RE: ghostscript and ghostview

Date: Tue, 19 Apr 1994 09:54:42 EDT
From: "Brian Tillman" <tillman@swdev.si.com>
To: info-vax@sri.com
Message-Id: <0097D2F2.961E5D40.20220@swdev.si.com>
Subject: RE: ghostscript and ghostview

In a previous article, fox@rudolf.nscl.msu.edu (Ron Fox) wrote:

>  I just went through a bit of a battle trying to get ghostscript  to
>compile and link on VAX/VMS 5.5-2 (ghostscript version 2.6.1).  I tried with
>both the VAX C compiler and the gcc c compiler and in each case got a fair  
>flood of compilation or link errors.   I was wondering if anybody has gotten
>this beast to work or, failing that, which versions of ghostscript have
>people gotten running on their VAX/VMS systems.

You won't be able to compile Ghostscript with VAX C, although you _must_ use VAX
C for one part of it.  You should use GCC for most of it.  Here's a message 
posted to the gnu.ghostscript.bugs newsgroup last year that explains how to 
compile.  Note:  To use Ghostview V1.5 with Ghostscript V2.6.1, you must have 
all four Ghostscript patches (pl1 through pl4).

--Begin included file--

Date:   30-SEP-1993 14:28
From: ROBERTS@fermi.nsrl.rochester.edu (Roland B Roberts)
Description: Re: GS 2.6.1 w/ VAX C (?)

In article <289ir2$8e3@charm.magnus.acs.ohio-state.edu>
DAVISM@kcgl1.eng.ohio-state.edu (Mike Davis, Chief of Operations --
KCGL) writes:  
 
	   Has anyone managed to compile GhostScript 2.6.1 with VAX C
   (image file identification: "VAX C V3.2-044" from ANALYZE/IMAGE)?  I
   am attempting to use the supplied VMS-CC.MAK command procedure with
   the source to GS 2.6.1PL4.  The really weird thing is, each time I
   start with a "fresh" compile (i.e. .OBJs, .OLB's, .LIS', etc. removed
   from previous compile attempt) I seem to get different compilation
   errors.  The OS version is 5.5-2, if that matters.  The hardware is a
   VAXstation 4000 Model 90.
 
You won't be able to compile GhostScript 2.6.1 with VAX C.  This was
discussed some time ago on gnu.ghostscript.bug.
 
What you really need is a combination of VAX C and GNU C to compile it.
This is because VAX C is non-ANSI is just the wrong places for the
current version of GhostScript.
 
I'm appending my version of a DCL command file for building GhostScript
2.6.1p4.  We're also running VMS V5.5-2, with Motif installed.  If you
don't have Motif running, you'll have a *lot* of small changes to make;
I can't really help you there.
 
This file does the same thing as the vms-cc.mak/vms-gcc.mak using the
`correct' combination of compilers.  It only builds the X11 driver.
 
roland
 
$ OLDDEF = F$ENV ("DEFAULT")
$ X = F$PARSE("A.B;0",F$ENV("PROCEDURE")) - "A.B;0"
$ SET DEFAULT 'X'
$ ON ERROR THEN GOTO DONE
$ ON CONTROL_Y THEN GOTO DONE
$! Copyright (C) 1989, 1992, 1993 Aladdin Enterprises.  All rights reserved.
$! Distributed by Free Software Foundation, Inc.
$!
$! This file is part of Ghostscript.
$!
$! Ghostscript is distributed in the hope that it will be useful, but
$! WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
$! to anyone for the consequences of using it or for whether it serves any
$! particular purpose or works at all, unless he says so in writing.  Refer
$! to the Ghostscript General Public License for full details.
$!
$! Everyone is granted permission to copy, modify and redistribute
$! Ghostscript, but only under the conditions described in the Ghostscript
$! General Public License.  A copy of this license is supposed to have been
$! given to you along with Ghostscript so you can know your rights and
$! responsibilities.  It should be in a file named COPYING.  Among other
$! things, the copyright notice and this notice must be preserved on all
$! copies.
$!
$!
$! "makefile" for Ghostscript, VMS / DECwindows (X11) configuration.
$!
$!
$! Execute this command file while in the Ghostscript directory!
$!
$!
$! To build a debugging configuration, issue the command:
$!
$!          $ @VMS.MAK DEBUG
$!
$! Do not  abbreviate "DEBUG".  To specify an alternate directory for
$! GS_LIB_DEFAULT, issue the command:
$!
$!          $ @VMS.MAK directory
$!
$! with "directory" a fully qualified directory name.  "directory" cannot
$! be DEBUG (otherwise it will be confused with the DEBUG switch).  Both
$! the DEBUG switch and a directory name may be specified on the same
$! command line and in either order.
$!
$! To specify a C compiler, use
$!
$!          $ @vms.mak cc=gcc
$! or
$!          $ @vms.mak cc=cc     ! this is the default
$!
$! All three switches may be specified in any order.
$!
$!
$ OPTIONS = f$edit("''P1' ''P2' ''P3'","TRIM,COMPRESS")
$!
$!
$ IF F$LOCATE("DEBUG",OPTIONS) .NE. F$LENGTH(OPTIONS)
$ THEN
$   COPT := /NOOPTIMIZE/DEBUG
$   CDEF := """DEBUG"""
$   LOPT := /DEBUG
$   OPTIONS = F$EDIT(OPTIONS-"DEBUG","TRIM,COMPRESS")
$ ELSE
$   COPT := /NOOPTIMIZE
$   CDEF := """VMS"""		! this is really just a placeholder
$   LOPT := ""
$ ENDIF
$!
$! Select the C compiler
$!
$ IF f$locate("CC=",OPTIONS) .NE. F$LENGTH(OPTIONS)
$ THEN
$   CC = F$EXTRACT(F$LOCATE("CC=",OPTIONS)+3,255,OPTIONS)
$   CC = F$EXTRACT(0,F$LOCATE(" ",OPTIONS),CC)
$   OPTIONS = F$EDIT(OPTIONS-"CC="-CC,"TRIM,COMPRESS")
$ ELSE CC := CC
$ ENDIF
$ IF CC .EQS. "CC"
$ THEN
$   LIBS := ""
$   DEFINE C$INCLUDE 'F$ENVIRONMENT("DEFAULT"),DECW$INCLUDE,SYS$LIBRARY
$   DEFINE VAXC$INCLUDE C$INCLUDE
$   DEFINE SYS SYS$LIBRARY
$   GOTO OPTIONS_OKAY
$ ENDIF
$ IF CC .EQS. "GCC"
$ THEN
$   IF F$TRNLNM("GNU_CC") .EQS. ""
$   THEN
$     TYPE SYS$INPUT
 
GNU_CC logical is undefined.  You must execute the command file
GCC_INSTALL.COM in the GNU CC directory before using this command file.
 
$     EXIT 44
$   ENDIF
$   LIBS := "GNU_CC:[000000]GCCLIB/LIB,"
$   SET COMMAND GNU_CC:[000000]GCC	! just to be sure
$   GOTO OPTIONS_OKAY
$ ENDIF
$ WRITE SYS$ERROR F$FAO("!/You have specified an unknown C compiler (!AS)",CC)
$ WRITE SYS$ERROR F$FAO("Please select either CC (default) or GCC.!/"
$ EXIT 44
$!
$ OPTIONS_OKAY:
$!
$! Select the Ghostscript Library Directory
$!
$ GS_INIT = "GS_INIT.PS"
$ GS_LIB_DEFAULT = F$ENVIRONMENT("DEFAULT")
$ IF OPTIONS .NES. ""
$ THEN
$   GS_LIB_DEFAULT = OPTIONS
$   IF F$PARSE (GS_LIB_DEFAULT) .EQS. ""
$   THEN
$     WRITE SYS$ERROR "The directory, ''gs_lib_default', does not exist!"
$     EXIT 44
$   ENDIF
$ ENDIF
$!
$! Compile genarch.c and then run it to create the arch.h header file
$!
$ CALL COMPILE GENARCH FALSE
$ LINK/NOMAP/EXE=GENARCH.EXE GENARCH,'LIBS'SYS$INPUT/OPT
SYS$SHARE:VAXCRTL/SHARE
$ GENARCH = "$" + F$ENVIRONMENT("DEFAULT") + "GENARCH.EXE"
$ GENARCH ARCH.H
$ PURGE GENARCH.EXE,GENARCH.OBJ
$ PURGE ARCH.H
$!
$!
$! Create a minimal gconfig.h.  To add devices, look in DEVS.MAK to find
$! the files that comprise the driver, and add them to the compilation
$! and linking lists below.  Then add a line below the CREATE of the form
$!	device__(gs_the-device-name_device)
$! e.g.
$!	device__(gs_bj10e_device)
$! To incorporate compiled fonts, add the line
$!	oper__(ccfonts_op_defs)
$! Also add the name ICCFONT and the names of the compiled fonts
$! to the compilation and linking lists.
$!
$!
$ CREATE GCONFIG.H
#include "gsconfig.h"
device__(gs_x11_device)
$!
$!
$! Create gconfigf.h similarly.  This is only used for compiled fonts.
$! For each compiled font XYZ, add a line of the form
$!	font_("0.font_XYZ",gsf_XYZ,zf_XYZ)
$! If you defined a "short name" for the font (see fonts.doc),
$! that is what you should use for XYZ.
$!
$!
$ CREATE GCONFIGF.H
$!
$! Create an empty object library
$!
$ IF F$SEARCH("GS.OLB") .EQS. "" THEN LIBRARY/CREATE GS.OLB
$!
$!
$! Create a list of modules to compile and store in the object library
$!
$ CREATE MODULES.LIS
GDEVMEM1
GDEVMEM2
GDEVMEM3
GP_NOFB
GP_VMS
GSCHAR
GSCHAR0
GSCIE
GSCOLOR
GSCOLOR2
GSCOORD
GSDEVICE
GSDPS1
GSFILE
GSFONT
GSHT
GSIMAGE
GSIMAGE1
GSIMAGE2
GSIMPATH
GSLINE
GSMATRIX
GSMISC
GSPAINT
GSPATH
GSPATH2
GSSTATE
GSTDEV
GSTYPE1
GSUTIL
GXCCACHE
GXCCMAN
GXCLIST
GXCLREAD
GXCMAP
GXCPATH
GXDITHER
GXDRAW
GXFILL
GXHINT1
GXHINT2
GXHT
GXPATH
GXPATH2
GXPCOPY
GXSTROKE
IALLOC
IBNUM
ICCFONT
IDEBUG
IDICT
IDPARAM
IINIT
INAME
INTERP
ISAVE
ISCAN
ISCAN2
IUTIL
SBITS
SCFD
SCFDTAB
SCFE
SCFTAB
SDCTD
SDCTE
SFILTER
SFILTER2
SLZWD
SLZWE
STREAM
ZARITH
ZARRAY
ZBSEQ
ZCHAR
ZCHAR2
ZCIE
ZCOLOR
ZCOLOR2
ZCONTROL
ZCSPACE2
ZDEVICE
ZDICT
ZDPS1
ZFILE
ZFILEDEV
ZFILEIO
ZFILTER
ZFILTER2
ZFONT
ZFONT0
ZFONT1
ZFONT2
ZGENERIC
ZGSTATE
ZHT
ZHT2
ZIMAGE2
ZMATH
ZMATRIX
ZMISC
ZMISC2
ZPACKED
ZPAINT
ZPATH
ZPATH2
ZPROPS
ZRELBIT
ZSTACK
ZSTRING
ZTYPE
ZUPATH
ZVMEM
ZVMEM2
$!
$!
$! NOW COMPILE AWAY!
$!
$ OPEN/READ MODULE_LIST MODULES.LIS
$!
$ COMPILE_LOOP:
$ READ/END=END_COMPILE MODULE_LIST MODULE
$ CALL COMPILE 'MODULE' TRUE
$ IF F$SEARCH("''MODULE'.OBJ") .NES. "" THEN DELETE 'MODULE'.OBJ.*
$ GOTO COMPILE_LOOP
$!
$ END_COMPILE:
$ CLOSE MODULE_LIST
$ PURGE MODULES.LIS
$!
$!
$! Is the DECwindows environment about?  Must be installed in order to
$! build the executable program gs.exe.
$!
$ IF F$SEARCH("SYS$SHARE:DECW$XLIBSHR.EXE") .NES. "" THEN GOTO CHECK2
$ WRITE SYS$OUTPUT "DECwindows user environment not installed;"
$ WRITE SYS$OUTPUT "unable to build executable programs."
$ GOTO DONE
$!
$ CHECK2:
$ IF F$TRNLNM("DECW$INCLUDE") .NES. "" THEN GOTO BUILD_EXES
$ WRITE SYS$OUTPUT "You must invoke @DECW$STARTUP before using this"
$ WRITE SYS$OUTPUT "command procedure to build the executable programs."
$ GOTO DONE
$!
$! Build the executables
$!
$ BUILD_EXES:
$!
$! Reformat MODULES.LIS into a valid option file for the linker
$!
$ OPEN/READ/SHARE  MOD MODULES.LIS
$ OPEN/WRITE/SHARE OPT MODULES.OPT
$ READ/END=NOMORE MOD MODULE
$ MODULE = "GS/LIB/INCLUDE=("+MODULE
$ NEXT:
$ READ/END=NOMORE MOD NEXTMOD
$ WRITE OPT MODULE,",-"
$ MODULE = NEXTMOD
$ GOTO NEXT
$ NOMORE:
$ WRITE OPT MODULE,")"
$ CLOSE MOD
$ CLOSE OPT
$ DELETE MODULES.LIS;*
$ PURGE MODULES.OPT
$!
$! Now compile the main routines.
$!
$ SAVE = CDEF
$ CDEF = "''CDEF'," -
       + """GS_LIB_DEFAULT=""""''GS_LIB_DEFAULT'""""""" + "," -
       + """GS_INIT=""""''GS_INIT'"""""""
$ CALL COMPILE GCONFIG FALSE
$ CDEF = SAVE
$!
$! Compile these but don't add them to the library
$!
$ CALL COMPILE GSMAIN FALSE
$ CALL COMPILE GS     FALSE
$!
$! These will only compile with VAXC
$!
$ COPT = COPT + "/INCLUDE_DIRECTORY=''F$TRNLNM("SYS$COMMON")'
$ CC := CC
$ DEFINE/NOLOG C$INCLUDE 'F$ENVIRONMENT("DEFAULT"),DECW$INCLUDE,SYS$LIBRARY
$ DEFINE/NOLOG VAXC$INCLUDE C$INCLUDE
$ DEFINE/NOLOG SYS SYS$LIBRARY
$ CALL COMPILE GDEVXINI FALSE
$ CALL COMPILE GDEVX    FALSE
$ CALL COMPILE GDEVXXF  FALSE
$ WRITE SYS$OUTPUT "Linking..."
$ LINK'LDEF'/NOMAP/EXE=GS.EXE GS,GSMAIN,GDEVX,GDEVXINI,GDEVXXF,GCONFIG,-
  MODULES.OPT/OPT,'LIBS'SYS$INPUT/OPT
SYS$SHARE:DECW$DWTLIBSHR/SHARE,SYS$SHARE:DECW$XLIBSHR.EXE/SHARE
$!
$ DELETE GDEVX.OBJ.*,GDEVXINI.OBJ.*,GSMAIN.OBJ.*,GS.OBJ.*,GCONFIG.OBJ.*
$!
$ DONE:
$! ALL DONE
$ DELETE GSLIB.LIS;*
$ IF F$TRNLNM("MODULE_LIST") .NES. "" THEN CLOSE MODULE_LIST
$ IF F$TRNLNM("MOD") .NES. "" THEN CLOSE MOD
$ IF F$TRNLNM("OPT") .NES. ""
$ THEN
$   CLOSE OPT
$   DELETE MODULES.OPT;
$ ENDIF
$ EXIT
$!
$ COMPILE: SUBROUTINE
$ ON ERROR THEN GOTO ABORT
$ ON CONTROL_Y THEN GOTO ABORT
$!
$! Arglist
$!   P1 module to be compiled
$!   P2 check library/add to library (TRUE or FALSE)
$!
$ COMPILE := FALSE
$ MODULE = P1
$ IF P2 .NES. ""
$ THEN CHECKLIB  = P2
$ ELSE CHECKLIB := TRUE
$ ENDIF
$ SRCTIME = F$CVTIME(F$FILE("''MODULE'.C","RDT"),"COMPARISON")
$ IF F$SEARCH ("''MODULE'.OBJ") .NES. ""
$ THEN					! Object file found
$   OBJTIME = F$CVTIME(F$FILE("''MODULE'.OBJ","RDT"),"COMPARISON")
$   IF SRCTIME .GTS. OBJTIME THEN COMPILE := TRUE
$ ELSE					! No object file
$   IF (F$SEARCH ("GS.OLB") .EQS. "") .OR. (.NOT. CHECKLIB)
$   THEN COMPILE := TRUE		! No library either
$   ELSE
$     IF F$SEARCH("GSLIB.LIS") .EQS. "" THEN LIBRARY/LIST=GSLIB.LIS/FULL GS.OLB
$     DEFINE/USER SYS$OUTPUT NLA0:	! Hide messages
$     DEFINE/USER SYS$ERROR  NLA0:
$     SEARCH/OUTPUT=GSLIB.MOD GSLIB.LIS 'MODULE'
$     IF $STATUS .EQ. %X08D78053	! String not found
$     THEN COMPILE := TRUE
$     ELSE				! Compare insertion date
$       OPEN/SHARE/READ DATA GSLIB.MOD
$       READ DATA MODTIME
$       CLOSE DATA
$       MODTIME = F$EXT(F$LOC("Inserted",MODTIME),255,MODTIME)
$       MODTIME = F$EXT(F$LOC(" ",MODTIME)+1,20,MODTIME)
$       MODTIME = F$CVTIME(MODTIME,"COMPARISON")
$       IF SRCTIME .GTS. MODTIME THEN COMPILE := TRUE
$     ENDIF
$     DELETE GSLIB.MOD;*
$   ENDIF
$ ENDIF					! IF F$SEARCH("''MODULE'.OBJ") .NES. ""
$ IF COMPILE
$ THEN
$   WRITE SYS$OUTPUT "Compiling ''MODULE'..."
$   'CC'/DEFINE=('CDEF')'COPT'/NOLIST/OBJECT='MODULE'.OBJ 'MODULE'.C
$ ENDIF
$ IF COMPILE .AND. CHECKLIB .AND. (F$SEARCH ("GS.OLB") .NES. "") THEN -
     LIBRARY/REPLACE GS.OLB 'MODULE'.OBJ
$ EXIT
$ ABORT:
$ EXIT 44
 
--
Roland B Roberts                          Nuclear Structure Research Laboratory
roberts@uornsrl.bitnet                                      271 East River Road
roberts@nsrl.rochester.edu                                  Rochester, NY 14627
--                                                               (716) 275-8962
I'm job hunting; tips and leads are appreciated!

--End included file--
-----------------------------+--------------------------------
 Brian Tillman               | Internet: tillman@swdev.si.com
 Smiths Industries, Inc.     |           tillman_brian@si.com
 4141 Eastern Ave., MS129    | Hey, I said this stuff myself.
 Grand Rapids, MI 49518-8727 | My company has no part in it.
-----------------------------+--------------------------------


