$NetBSD: patch-ab,v 1.12 2006/02/04 13:17:51 markd Exp $

--- Imakefile.orig	2004-04-27 08:24:41.000000000 +1200
+++ Imakefile
@@ -45,6 +45,7 @@ XCOMM different tree than the "correct" 
 XCOMM purpose of DESTDIR is to test an install process by installing in a benign area.
 
 XCOMM XAPPLOADDIR = /home/user/xfig
+      XAPPLOADDIR = $(LIBDIR)/app-defaults
 
 XCOMM Uncomment the following definition for XAW3D if you want to use
 XCOMM the 3d Athena Widget Set (highly recommended!)
@@ -58,21 +59,24 @@ XCOMM #define XAW3D1_5E
 
 #ifdef XAW3D1_5E
     DUSEXAW3D = -DXAW3D -DXAW3D1_5E
-    XAWLIB = -lXaw3d15e
+    XAWLIB = -lXaw3d
 #else
-    XAW_SRC = w_menuentry.c SmeCascade.c SmeBSB.c SimpleMenu.c
-    XAW_OBJ = w_menuentry.o SmeCascade.o SmeBSB.o SimpleMenu.o
 #   ifdef XAW3D
-	DUSEXAW3D = -DXAW3D
-	XAWLIB = -lXaw3d
+      DUSEXAW3D = -DXAW3D
+      XAWLIB = -lXaw3d
+      XAW_SRC = SmeCascade.c
+      XAW_OBJ = SmeCascade.o
+#   else
+      XAW_SRC = w_menuentry.c SmeCascade.c SmeBSB.c SimpleMenu.c
+      XAW_OBJ = w_menuentry.o SmeCascade.o SmeBSB.o SimpleMenu.o
 #   endif /* XAW3D */
 #endif /* XAW3D1_5E */
 
 XCOMM Redefine the following if your PNG library, zlib library and/or include file
 XCOMM are in different places
 
-PNGLIBDIR = $(USRLIBDIR)
-PNGINC = -I/usr/local/include
+PNGLIBDIR = $(LOCALBASE)/lib
+PNGINC = -I$(LOCALBASE)/include
 ZLIBDIR = $(USRLIBDIR)
 
 XCOMM If don't want JPEG support, comment out the #define USEJPEG line
@@ -92,8 +96,8 @@ XCOMM You must have version 5b or newer 
 
 #ifdef USEJPEG
 #ifdef USEINSTALLEDJPEG
-JPEGLIBDIR = /usr/local/lib
-JPEGINC = -I/usr/include/X11
+JPEGLIBDIR = $(LOCALBASE)/lib
+JPEGINC = -I$(LOCALBASE)/include
 #else
 JPEGLIBDIR = ../jpeg
 JPEGINC = -I$(JPEGLIBDIR)
@@ -115,8 +119,8 @@ XCOMM Change XPMINC if necessary to poin
 #define USEXPM_ICON
 
 #ifdef USEXPM
-XPMLIBDIR = $(USRLIBDIR)
-XPMINC = -I/usr/include/X11
+XPMLIBDIR = $(X11BASE)/lib
+XPMINC = -I$(X11BASE)/include/X11
 #endif
 
 XCOMM Uncomment the following definiton if you want to use the small icons
@@ -157,7 +161,7 @@ XCOMM uncomment the following line if yo
 XCOMM inline functions. With the "INLINE" keyword, you should notice that
 XCOMM the display will be a bit faster in complex figures
 
-XCOMM USEINLINE = -DUSE_INLINE
+USEINLINE = -DUSE_INLINE
 
 XCOMM use (and change) the following if you want the multi-key data base file
 XCOMM somewhere other than the standard X11 library directory
@@ -169,7 +173,7 @@ XFIGLIBDIR = $(LIBDIR)/xfig
 
 XCOMM XFIGDOCDIR tells where the html and pdf documentation should go
 XCOMM XFIGDOCDIR = $(DOCDIR)/xfig
-XFIGDOCDIR = /usr/share/doc/xfig
+XFIGDOCDIR = $(PREFIX)/share/doc/xfig
 
 XCOMM MANDIR tells where the standard man pages should go (no need to change it
 XCOMM if you want the man pages installed in the standard place on your system
@@ -229,7 +233,7 @@ INSTDATFLAGS = -m 0644
 #ifdef USEJPEG
 
 #ifdef USEINSTALLEDJPEG
-JPEGLIB = -L$(JPEGLIBDIR) -ljpeg
+JPEGLIB = -Wl,-R$(LOCALBASE)/lib -L$(JPEGLIBDIR) -ljpeg
 #else
 JPEGCONF = configure
 JPEGLIB = $(JPEGLIBDIR)/libjpeg.a
@@ -266,7 +270,7 @@ InstallManPageLong(file,dest,file)
 DUSESMALLICONS = -DUSE_SMALL_ICONS
 #endif /* USESMALLICONS */
 
-PNGLIBS = -L$(PNGLIBDIR) -lpng -L$(ZLIBDIR) -lz
+PNGLIBS = -Wl,-R$(LOCALBASE)/lib -L$(PNGLIBDIR) -lpng -lz
 
 #ifdef USEJPEG
 DUSEJPEG = -DUSE_JPEG
@@ -276,7 +280,7 @@ READJPEGO = f_readjpg.o
 
 #ifdef USEXPM
 DUSEXPM = -DUSE_XPM
-XPMLIBS = -L$(XPMLIBDIR) -lXpm
+XPMLIBS = -Wl,-R$(XPMLIBDIR) -L$(XPMLIBDIR) -lXpm
 READXPMS = f_readxpm.c
 READXPMO = f_readxpm.o
 #ifdef USEXPM_ICON
@@ -411,6 +415,8 @@ install.html::
 install.rhtml::
 	@(cd Doc ; \
 	echo Copying pdf and html files to $(DESTDIR)$(XFIGDOCDIR) ; \
+	if [ -d $(DESTDIR)$(XFIGDOCDIR) ]; then set +x; \
+	   else (set -x; $(MKDIRHIER) $(DESTDIR)$(XFIGDOCDIR) ); fi ; \
 	$(INSTALL) -m 644 -c xfig_man.html $(DESTDIR)$(XFIGDOCDIR) ; \
 	$(INSTALL) -m 644 -c xfig_ref_en.pdf $(DESTDIR)$(XFIGDOCDIR) ; \
 	$(INSTALL) -m 644 -c xfig-howto.pdf $(DESTDIR)$(XFIGDOCDIR) ; \
@@ -469,13 +475,13 @@ install.libs::
 						else (set -x; $(MKDIRHIER) $(DESTDIR)$(OBJLIBDIR)/$$d/$$f/$$dd/$$l ); fi ; \
 					    (cd $$l ; \
 						for m in * ; do \
-						    $(INSTALL) -m 644 -c $$m $(DESTDIR)$(OBJLIBDIR)/$$d/$$f/$$dd/$$l ; \
+						    $(INSTALL) -m 644 -c ./$$m $(DESTDIR)$(OBJLIBDIR)/$$d/$$f/$$dd/$$l ; \
 						done ) ) ; \
-					else ( $(INSTALL) -m 644 -c $$l $(DESTDIR)$(OBJLIBDIR)/$$d/$$f/$$dd ) ; fi ; \
+					else ( $(INSTALL) -m 644 -c ./$$l $(DESTDIR)$(OBJLIBDIR)/$$d/$$f/$$dd ) ; fi ; \
 				done) ) ; \
-			    else ( $(INSTALL) -m 644 -c $$dd $(DESTDIR)$(OBJLIBDIR)/$$d/$$f ) ; fi ; \
+			    else ( $(INSTALL) -m 644 -c ./$$dd $(DESTDIR)$(OBJLIBDIR)/$$d/$$f ) ; fi ; \
 			done) ); \
-		else ($(INSTALL) -m 644 -c $$f $(DESTDIR)$(OBJLIBDIR)/$$d ) ; fi ; \
+		else ($(INSTALL) -m 644 -c ./$$f $(DESTDIR)$(OBJLIBDIR)/$$d ) ; fi ; \
 	    done ) ; \
 	done ; ) ; \
 	else echo No Object Libraries to install ; \
