$NetBSD: patch-ab,v 1.11 2005/11/12 16:08:21 itohy Exp $

--- Imakefile.orig	Tue Apr 27 05:24:41 2004
+++ Imakefile	Sat Nov 12 19:58:54 2005
@@ -45,6 +45,7 @@
 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 @@
 
 #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 @@
 
 #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 @@
 #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 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 @@
 
 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 @@
 #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 @@
 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 @@
 
 #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.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) ; \
