Ilya Zakharevich on Mon, 13 May 2002 20:57:14 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: DYNAMIC_PLOTTING with gnuplot made easy


This patch adds Configure-support, as well as fixes a cosmetic bug
(warning from Perl).

Enjoy,
Ilya

--- ./Configure-pre-c	Mon May 13 19:41:24 2002
+++ ./Configure	Mon May 13 20:00:04 2002
@@ -123,7 +123,7 @@ Options: some names can be abbreviated t
 Build Options:
   --host=<arch-osname>  target achitecture
   --graphic=<gr>        graphic library used (default X11) (none X11 gnuplot 
-							    gnuplot-dynamic)
+	gnuplot-dynamic builtin.X11-gnuplot builtin.X11-gnuplot-dynamic)
 Additional developer options:
   -g              creates debugging version (in Oxxx.dbg)
   -pg             creates profiling version (in Oxxx.prf)
@@ -652,7 +652,10 @@ EOM
 #  Graphic libs now.
 #
   if test "$fastread" != yes; then
-    if test -n "$X11"; then addX11=X11; fi
+    if test -n "$X11"; then addX11="X11 builtin.X11-gnuplot-dynamic"; fi
+    if test -n "$X11" -a -n "$addgnuplot"; then
+	addX11="$addX11 builtin.X11-gnuplot"
+    fi
     cat << EOT
 ==========================================================================
 GP contains high resolution plotting functions. Choose among
@@ -664,8 +667,7 @@ EOT
     which_graphic_lib=$ans
 
   case "$which_graphic_lib" in
-    X11)
-      gnuplot=;
+    *X11*)
       # If xmkmf did not give the right answer
       # X11 -- Headers
       if test ! -f $Xincroot/X11/Xos.h; then
@@ -713,7 +715,9 @@ EOT
         pth=$x11pth;
         lib=X11; . ./locatelib
       fi ;;
-    gnuplot*) ;;
+  esac
+  case "$which_graphic_lib" in
+    *gnuplot*) ;;
     *)gnuplot=;;
   esac
   else # fastread = yes
@@ -783,7 +787,9 @@ if test -z "$CC"; then
   if test -n "$__gnuc__"; then CC=$gcc; else CC=$cc; fi
 fi
 
-if test "$which_graphic_lib" = gnuplot -a -z "$gcc"; then
+if test -z "$gcc"; then
+ case "$which_graphic_lib" in
+   *gnuplot)
     lib=$gnuplot_fullpath; sym=_eprintf; . ./locatesymbol
     if test -n "$try"; then
 	echo "...Looks like gcc-compiled gnuplot.  I add -lgcc to graphic libraries"
@@ -807,6 +813,8 @@ if test "$which_graphic_lib" = gnuplot -
 	gcc="$_ogcc"
 	gnuplot_libs="$gnuplot_libs -lgcc"
     fi
+    ;;
+ esac
 fi
 
 
--- ./config/Makefile.SH-pre-c	Mon May 13 19:41:50 2002
+++ ./config/Makefile.SH	Mon May 13 19:52:33 2002
@@ -62,14 +62,12 @@ hlist="$hlist paridecl"
 
 case "$which_graphic_lib" in
 none)
-  PLOTFILE=plotnull.c
   PLOTCFLAGS=
   PLOTLIBS=
   plotrunpath=
   graph="$graph plotnull"
   ;;
 gnuplot)
-  PLOTFILE=plotgnuplot.c
   PLOTCFLAGS=
   GNUPLOT_OBJS="bitmap\$(_O) term\$(_O) util\$(_O) version\$(_O) stdfn\$(_O)"
   PLOTLIBS="$gnuplot_libs"
@@ -81,20 +79,39 @@ gnuplot)
   graph="$graph plotgnuplot"
   ;;
 gnuplot-dynamic)
-  PLOTFILE=plotgnuplot.c
   PLOTCFLAGS="-DDYNAMIC_PLOTTING -DDYNAMIC_PLOTTING_RUNTIME_LINK=NULL"
   PLOTLIBS=
   plotrunpath=
   graph="$graph plotgnuplot"
   ;;
-gnuplot-dynamic)
-  PLOTFILE=plotgnuplot.c
-  PLOTCFLAGS="-DDYNAMIC_PLOTTING -DDYNAMIC_PLOTTING_RUNTIME_LINK=NULL"
-  PLOTLIBS=
-  plotrunpath=
+builtin.X11-gnuplot)
+  cflags="$cflags -DBOTH_GNUPLOT_AND_X11"
+  PLOTCFLAGS=-I$Xincroot
+  GNUPLOT_OBJS="bitmap\$(_O) term\$(_O) util\$(_O) version\$(_O) stdfn\$(_O)"
+  if test "$osname" = concentrix; then
+    PLOTLIBS="$gnuplot_libs -lX11"
+  else
+    PLOTLIBS="$gnuplot_libs -L$X11 -lX11 $extralib"
+  fi
+  plotrunpath=$X11
+  case "$osname" in
+    os2) libgnuplot=$gnuplot/gnuplot.a;;
+    *) libgnuplot=$gnuplot/libgnuplot.a;;
+  esac
+  graph="$graph plotgnuplot plotX"
+  ;;
+builtin.X11-gnuplot-dynamic)
+  cflags="$cflags -DBOTH_GNUPLOT_AND_X11"
+  PLOTCFLAGS="-I$Xincroot -DDYNAMIC_PLOTTING -DDYNAMIC_PLOTTING_RUNTIME_LINK=NULL"
+  if test "$osname" = concentrix; then
+    PLOTLIBS="-lX11"
+  else
+    PLOTLIBS="-L$X11 -lX11 $extralib"
+  fi
+  plotrunpath=$X11
+  graph="$graph plotgnuplot plotX"
   ;;
 X11)
-  PLOTFILE=plotX.c
   PLOTCFLAGS=-I$Xincroot
   PLOTLIBS="-L$X11 -lX11 $extralib"
   if test "$osname" = concentrix; then PLOTLIBS="-lX11"; fi
@@ -238,7 +255,6 @@ INSTALL_PROGRAM = \$(INSTALL)
 INSTALL_DATA = \$(INSTALL) -m 644
 
 # Graphic library.
-PLOTFILE   = $PLOTFILE
 PLOTCFLAGS = $PLOTCFLAGS
 PLOTLIBS   = $PLOTLIBS
 GNUPLOT_OBJS = $GNUPLOT_OBJS
--- ./src/graph/plotgnuplot.c-pre-c	Mon May 13 20:09:32 2002
+++ ./src/graph/plotgnuplot.c	Mon May 13 20:13:39 2002
@@ -433,7 +433,7 @@ get_term_ftable_get(void) /* Establish r
 	/* Find the name of the DLL file */
 	sprintf(cmdbuf, "perl -MDynaLoader -we %c"
 		"package DynaLoader; "
-		"print mod2fname[qw(Term Gnuplot)] if defined &mod2fname%c",
+		"print mod2fname([qw(Term Gnuplot)]) if defined &mod2fname%c",
 		SHELL_Q, SHELL_Q);
 	p = popen(cmdbuf, "r");
 	if (p) {