From: pinch@cs.washington.edu (Ricardo Pincheira)
Newsgroups: comp.os.linux.announce
Subject: gnuplot and linux - works great
Date: 8 Apr 1993 22:23:10 GMT
Approved: linux-announce@tc.cornell.edu (Matt Welsh)
Message-ID: <1q28ke$dh3@fitz.TC.Cornell.EDU>

Fellow linuxers:
    Here are my experiences installing gnuplot under linux for those of
    you who are interested.  Basically, I had no problems whatsoever (well, the
    usual pesky little things that took a little bit to figure out).  I'm
    including some diffs so you don't have to rediscover them.

    Things seem to work just fine.

Gnuplot and linux
-----------------
    Gnuplot is a nifty package to produce all sorts of graphs -- including
    surface plots, available via ftp (see below).  Gnuplot works fine with
    linux!  I am currently running SLS 99p6, including the X series and
    the C series,  fetched 03.02.93 from tsx-11.mit.edu (ChangeLog there
    shows several changes in the few short weeks since I fetched the stuff!).
    I am running this on an AST Powerexec laptop, which is a generic AT-bus
    386/486 machine, so I don't see why it shouldn't work on other ISA bus
    machines on which linux runs.  I had no problems installing gnuplot.  I can
    show graphs in an x window, and also produce postscript output to send
    to a printer (not hooked up to my linux box, though :-( ).
    Even more surprisingly, the graphs look the same that they look on
    some R-3000 based decstations whose output I trust!  And the
    postscript output is the same.

Installation of gnuplot
-----------------------
    In order to install gnuplot, you will need to have the linux sources,
    since you will need to use the linux include files.  These were not
    in the SLS release, so I had to fetch them separately from
    tsx-11.mit.edu:/pub/linux/sources/system.  There's a tar.Z file there.
    I put mine as recommended under /usr/src/linux/..... You will  need
    a symlink named /usr/include/linux --> /usr/src/linux/include/linux
    (which is where the include files actually reside if you put them
    as recommended).  My SLS 99p6 release of linux
    (obtained 03.02.93 from tsx-11) already conatined this symlink,
    though the actual sources I had to get and install separately.

    The official site for getting gnuplot via anonymous
    ftp is dartmouth.edu (129.170.16.4). Fetch pub/gnuplot/gnuplot3.2.tar.Z
    and put it wherever you want.

    The installation procedure is quite simple and well documented in
    a file called README.Install and a whole bunch of makefiles, each named
    makefile.xxx for some xxx.  For linux, the one you want to use is
    makefile.unx.  You simply copy makefile.unx to Makefile, edit it to
    taste (I'm including diffs below), edit 2 files called plot.h and term.h,
    do the make, and things work!

    I put my gnuplot under /local/extras/gnu/gnuplot/...  In my machine,
    /local is the mount point for a 64MB partition where I'm putting all
    the stuff that didn't fit into my primary linux partition.

    From the documentation in the makefile.unx and README.INSTALL,
    it said we should look at a whole bunch of cpp defines, in term.h,
    plot.h, and Makefile/makefile.unx.  Here are a couple of very
    terse explanations and the diffs:

    Defines in the Makefile and plot.h: (yes == define, no == undefined)
    NOVFORK - yes (linux has fork with copy on write, btw)
    GAMMA - libm.a has an lgamma but no gamma (use nm to see this).
            I defined GAMMA to lgamma, guiding myself from an an
            APOLLO_FLAGS definition in the makefile.unx which has
            -DGAMMA=lgamma.
    MEMCPY - no, we have a bcopy
    MEMSET - no, we have a bzero
    NOCOPY - no
    bcopy () - leave as is
    PC - this is only for MS-DOS.  Linux is a real system :-)
    HELPFILE - this path must be defined too.  I ended up having to use
            symlinks after the fact, so it's not too serious a problem
            if you mess up.
    VERYLARGE - though linux has a float.h and VERYLARGE was getting
        initialized to something like 1.79.... e+308 (verified by cpp), this
        is much too big and will cause a floating overlow during
        compilation.  You should explicitly initialize the value
        of VERYLARGE in term.h.  I set it to 1e38, which is the
        suggested setting.
     SHELL: in plot.h.  Define this to taste.  I use tcsh and have a symlink
        from /bin/csh to tcsh, so I just set it to /bin/csh
     NOCWDRC - yes -- it's the setting recommended in the gnuplot
        installation documentation.
     READLINE - yes
     TERMFLAGS - edit term.h.  You should add whatever terminal types
         you want.  I used X11, POSTSCRIPT, FIG.  Things worked fine for
         me (well, I haven't tested FIG yet since I don't yet have xfig
         installed in my linux box).  Note that if worse comes to worse,
         you can just dump to postscript and then use gs or ghostview
         to view it.

    CC = gcc
    LASERGNU = lasergnu_noinstall (since I don't have a printer there's
                                   no point in installing it)
    X11INCLUDES = -I/usr/include/X11

Here are some diffs for term.h, plot.h, and makefile.unx.
Some contain definitions applicable only to my particular installation,
eg, some of the paths.

===========================diffs for term.h============================

107,109d106
< #define FIG		/* added by pinch */
< #define X11		/* added by pinch */
< 
===========================diffs for plot.h============================

47c47
< #define SHELL "/bin/csh"		/* used if SHELL env variable not set */
---
> #define SHELL "/bin/sh"		/* used if SHELL env variable not set */
155d154
< #define VERYLARGE 1e38	/* added by pinch since we had an e308 before*/
===========================diffs for makefile.unx============================

23c23
< DEST=/local/extras/gnu/gnuplot/bin
---
> DEST=/usr/local/bin
25c25
< MANDEST=/local/extras/gnu/gnuplot/man
---
> MANDEST=/usr/local/man/manl
30c30
< EMAIL=pinch@softland.softlanding.com
---
> EMAIL=bug-gnuplot@ames.arc.nasa.gov
34c34
< CC     = gcc # the C compiler
---
> CC     = cc # the C compiler
67,68c67
< #LASERGNU = lasergnu_install
< LASERGNU = lasergnu_noinstall
---
> LASERGNU = lasergnu_install
78,79c77
< #>>> pinch: be sure to use -I flag here!!
< X11INCLUDES = -I/usr/include/X11
---
> X11INCLUDES =
151c149
< TERMFLAGS = -Iterm -DUNIXPLOT $(PLOTXFLAG)
---
> TERMFLAGS = -Iterm -DUNIXPLOT $(PLOTXFLAG) 
174,187d171
< # I (pinch) copied this straight from the X11_FLAGS, then added -D stuff
< # appropriatedly to the CFLAGS line.  I guided myself from the
< # APOLLO_FLAGS , because they have an lgamma, and linux does too,
< # in libm.a
< # (no plain gamma in linux).  Also, linux doesn't have VFORK
< # (but it's fork is copy on write. . .)
< LINUX_X11_FLAGS = \
<     	   CFLAGS="$(COPTS) $(OPTIONS) -DNOVFORK -DGAMMA=lgamma " \
<     	   LIBS="-lm" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
<     	   X11LIBS="$(X11LIBS)" \
<     	   PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
<     	   X11INSTALL="$(X11INSTALL)" \
<     	   TERMFLAGS="-Iterm -DX11"
< 
409d392
< 	@echo "linux_x11    for 386 machines running linux 99p6 with X11"
466,468d448
< linux_x11:
< 	$(MAKE) $(MFLAGS) $(MY_FLAGS) $(LINUX_X11_FLAGS)    $(TARGET)
< 
548c528
< 	@echo "apollo, dec, hp, sun, sun_x11, sgi, sgix11, cgi, linux_x11"
---
> 	@echo "apollo, dec, hp, sun, sun_x11, sgi, sgix11, cgi,"
555d534
< 	@echo "         make linux_x11    TARGET=Install "

=====================================================================

    At this stage, after copying makefile.unx to Makefile and
    updating as shown above, you can just say:

    make linux_X11

    The only problems I had (well, after solving all the previous ones!)
    were:


    gcc  -O  -DREADLINE -DNOCWDRC -DNOVFORK -DGAMMA=lgamma    -c parse.c -o
    parse.o
    In file included from parse.c:46:
    plot.h:155: warning: `VERYLARGE' redefined
    plot.h:150: warning: this is the location of the previous definition
    parse.c: In function `fpe':
    parse.c:94: warning: passing arg 2 of `signal' from incompatible
    pointer type
    parse.c: In function `evaluate_at':
    parse.c:142: warning: passing arg 2 of `signal' from incompatible
    pointer type

    Got this "incompatible pointer type warning" from a few other places
    too, but it shouldn't be a problem.

    To install the man pages, do 

    make man_install
    ln -s /local/extras/gnu/gnuplot/man/gnuplot.1 gnuplot.1

    Apparently I didn't set the HELPFILE definition quite correctly,
    because I had to add a symlink:

    ln -s /local/extras/gnu/gnuplot/docs/gnuplot.gih /usr/lib/ gnuplot.gih 

    Finally, I symlinked the gnuplot executables to /usr/bin:

    ln -s /local/extras/gnu/gnuplot/gnuplot /usr/bin/gnuplot
    ln -s /local/extras/gnu/gnuplot/gnuplot_x11 /usr/bin/gnuplot_x11

    Again, the particular paths above are where I put stuff in my
    particular installation and will differ for you.

Have fun.   Feel free to send me mail if you have questions -- I might
even be able to respond intelligently.

Ricardo
pinch@cs.washington.edu

-- 
Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu
