$NetBSD: patch-aa,v 1.5 2002/10/02 20:56:35 dillo Exp $

--- configure.in.orig	Fri Dec 17 16:01:06 1999
+++ configure.in
@@ -284,7 +284,7 @@
   ar r libfitest_f.a fitest_f.o
   OLD_LIBS="$LIBS"
   LIBS="-L. -lfitest_f"  
-  CFLAGS="-DUSE_UPPER"
+  CFLAGS="$CFLAGS -DUSE_UPPER"
 ]
 
   AC_TRY_RUN([#include "fitest.h"
@@ -298,7 +298,7 @@
                      [F77CONV="no"])
 
 [ if test "$F77CONV" = "no" ; then 
-  CFLAGS="-DUSE_F2C" ]
+  CFLAGS="$CFLAGS -DUSE_F2C" ]
 AC_TRY_RUN([#include "fitest.h"
                  main()
                  { 
@@ -311,7 +311,7 @@
 [ fi ]
 
 [ if test "$F77CONV" = "no" ; then 
-  CFLAGS="-DUSE_LOWER" ]
+  CFLAGS="$CFLAGS -DUSE_LOWER" ]
 AC_TRY_RUN([#include "fitest.h"
                  main()
                  { 
@@ -324,7 +324,7 @@
 [ fi ]
 
 [ if test "$F77CONV" = "no" ; then 
-  CFLAGS="-DUSE_FRONT" ]
+  CFLAGS="$CFLAGS -DUSE_FRONT" ]
 AC_TRY_RUN([#include "fitest.h"
                  main()
                  { 
@@ -524,7 +524,7 @@
 if test -z "$x_libraries" ; then
   xlibdir=""
 else
-  xlibdir="-L$x_libraries"
+  xlibdir="-Wl,-R$x_libraries -L$x_libraries"
 fi
 
 X11LIB="$xlibdir -lX11"
@@ -551,12 +551,6 @@
   PLOT_PROG="gnuplot"
 ])
 
-[
-if test -n "$PLOT_PROG" ; then
-  ] AC_CHECK_PROG(PLOT_PROG, gnuplot, gnuplot, nothing) [
-fi
-]
-
 dnl ------------------------------------------------------------------
 dnl Check for specification of Plplot directory root
 dnl
@@ -572,11 +566,12 @@
     exit 1;
   fi
 
+  AC_DEFINE(HAVE_RLAB_PLPLOT)
   PLOT_PROG="plplot"
-  PLIB_DIR=-L$withval
+  PLIB_DIR=-L$withval/lib
   PLOT_DIR="$withval"
-  PLIB_INC_DIR="-I$withval"
-  PLIBS="-L$withval -lplplotdX $X11LIB"
+  PLIB_INC_DIR=-I$withval/include
+  PLIBS=`plplot_linkage`
 ])
 
 dnl ------------------------------------------------------------------
@@ -593,12 +588,6 @@
   PLOT_PROG="plotmtv"
 ])
 
-[
-if test "$PLOT_PROG" = "plotmtv" ; then
-  ] AC_CHECK_PROG(PLOT_PROG, plotmtv, plotmtv, nothing) [
-fi
-]
-
 dnl ------------------------------------------------------------------
 dnl Use the Pgraf interface.
 dnl
@@ -613,12 +602,6 @@
   PLOT_PROG="pgraf"
 ])
 
-[
-if test "$PLOT_PROG" = "pgraf" ; then
-  ] AC_CHECK_PROG(PLOT_PROG, pgraf, pgraf, nothing) [
-fi
-]
-
 dnl ------------------------------------------------------------------
 dnl Check for specification of PGplot directory root
 dnl
@@ -648,14 +631,13 @@
 dnl then setup for GC. The default action (nothing is specified) is to
 dnl configure for GC.
 
-AC_ARG_ENABLE(GC,
-            [  --disable-GC            disable use of the Garbage-Collector],
-            [if test "$enableval" = "yes" ; then
-               AC_DEFINE(HAVE_GC) [LIBGC="../gc/gc.a"; 
-                                   IGC="-I./gc"]
-             fi],
-            [AC_DEFINE(HAVE_GC) [LIBGC="./gc/gc.a";
-                                 IGC="-I./gc"]])
+AC_ARG_WITH(GC,
+            [  --with-GC            use the Garbage-Collector],
+             AC_DEFINE(HAVE_GC)
+	     LIBGC="-L$withval/lib -lgc"
+             IGC="-I$withval/include -I./gc"
+)
+
 dnl ------------------------------------------------------------------
 
 AC_TRY_LINK([#include <stdio.h>],
@@ -738,6 +720,7 @@
 AC_SUBST(PAGER)
 AC_SUBST(CFLAGS)
 AC_SUBST(FFLAGS)
+AC_SUBST(LDLAGS)
 AC_SUBST(EXFLAGS)
 AC_SUBST(C_SH_FLAGS)
 AC_SUBST(F_SH_FLAGS)
