--- Makefile.in.orig	Tue May 21 09:13:50 2002
+++ Makefile.in	Tue May 21 16:02:12 2002
@@ -56,7 +56,9 @@
 BIN_DIR =		$(exec_prefix)/bin
 
 # Directory in which to install the include file tk.h:
-INCLUDE_INSTALL_DIR =	$(INSTALL_ROOT)$(prefix)/include
+INCLUDE_INSTALL_DIR =	$(INSTALL_ROOT)$(prefix)/include/tk$(VERSION)
+GENERIC_INCLUDE_INSTALL_DIR = $(INCLUDE_INSTALL_DIR)/generic
+UNIX_INCLUDE_INSTALL_DIR = $(INCLUDE_INSTALL_DIR)/unix
 
 # Top-level directory for manual entries:
 MAN_INSTALL_DIR =	$(INSTALL_ROOT)$(prefix)/man
@@ -72,6 +74,9 @@
 # Tcl commands implemented by Tk:
 MANN_INSTALL_DIR =	$(MAN_INSTALL_DIR)/mann
 
+# Directory in which to install sharedable other documents:
+DOC_INSTALL_DIR =	$(INSTALL_ROOT)$(prefix)/share/doc/tk$(VERSION)
+
 # The directory containing the Tcl sources and headers appropriate
 # for this version of Tk ("srcdir" will be replaced or has already
 # been replaced by the configure script):
@@ -112,7 +117,7 @@
 
 # Libraries to use when linking.  This definition is determined by the
 # configure script.
-LIBS = @TCL_BUILD_LIB_SPEC@ @LIBS@ $(X11_LIB_SWITCHES) @DL_LIBS@ @MATH_LIBS@ -lc
+LIBS = @TCL_LIB_SPEC@ @LIBS@ $(X11_LIB_SWITCHES) @DL_LIBS@ @MATH_LIBS@ -lc
 
 # To turn off the security checks that disallow incoming sends when
 # the X server appears to be insecure, reverse the comments on the
@@ -148,7 +153,7 @@
 # "install" around;  better to use the install-sh script that comes
 # with the distribution, which is slower but guaranteed to work.
 
-INSTALL = @srcdir@/install-sh -c
+INSTALL = install -c
 INSTALL_PROGRAM =	${INSTALL}
 INSTALL_DATA =		${INSTALL} -m 644
 
@@ -161,6 +166,8 @@
 TK_SHLIB_CFLAGS = @TK_SHLIB_CFLAGS@
 
 TK_LIB_FILE = @TK_LIB_FILE@
+TCL_L10N = @TCL_L10N@
+TK_STATIC_LIB_FILE = libtk80$(TCL_L10N).a
 #TK_LIB_FILE = libtk.a
 
 TK_LIB_FLAG = @TK_LIB_FLAG@
@@ -187,11 +194,11 @@
  
 KANJI_FLAGS = @KANJI_FLAGS@
  
-CACHEDIR=$(UNIX_DIR)/CacheLib
-CACHEDFONTDEF = -I$(CACHEDIR) @XLIB_HACK_DEF@
-CACHEDFONTSRCS = $(CACHEDIR)/Font.c $(CACHEDIR)/FontNames.c $(CACHEDIR)/omGeneric.c \
-	$(CHACHEDIR)/chkImEv.c $(CHACHEDIR)/imTrX.c
-CACHEDFONTOBJS = Font.o FontNames.o omGeneric.o chkImEv.o imTrX.o
+#CACHEDIR=$(UNIX_DIR)/CacheLib
+#CACHEDFONTDEF = -I$(CACHEDIR) @XLIB_HACK_DEF@
+#CACHEDFONTSRCS = $(CACHEDIR)/Font.c $(CACHEDIR)/FontNames.c $(CACHEDIR)/omGeneric.c \
+#	$(CHACHEDIR)/chkImEv.c $(CHACHEDIR)/imTrX.c
+#CACHEDFONTOBJS = Font.o FontNames.o omGeneric.o chkImEv.o imTrX.o
 
 #----------------------------------------------------------------
 # The information below is modified by the configure script when
@@ -318,6 +325,10 @@
 
 DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget
 
+DOCS = $(TOP_DIR)/README $(TOP_DIR)/changes $(TOP_DIR)/README.JP \
+	$(TOP_DIR)/Incompat80jp $(TOP_DIR)/changes.JP \
+	$(UNIX_DIR)/README.FreeBSD
+
 all: wish
 
 # The following target is configured by autoconf to generate either
@@ -326,6 +337,14 @@
 	rm -f ${TK_LIB_FILE}
 	@MAKE_LIB@
 	$(RANLIB) ${TK_LIB_FILE}
+.if ${PORTOBJFORMAT}X == elfX
+	ln -sf ${TK_LIB_FILE} `echo ${TK_LIB_FILE} | sed 's/\.so.*$$/.so/'`
+.endif
+
+$(TK_STATIC_LIB_FILE): $(OBJS)
+	rm -f $(TK_STATIC_LIB_FILE)
+	ar cr $(TK_STATIC_LIB_FILE) $(OBJS)
+	$(RANLIB) $(TK_STATIC_LIB_FILE)
 
 # Make target which outputs the list of the .o contained in the Tk lib
 # usefull to build a single big shared library containing Tcl/Tk and other
@@ -375,13 +394,13 @@
 	TK_LIBRARY=$(TOP_DIR)/library; export TK_LIBRARY; \
 	./tktest
 
-install: install-binaries install-libraries install-demos install-demosjp install-man
+install: install-binaries install-libraries install-demos install-demosjp
 
 # Note: before running ranlib below, must cd to target directory because
 # some ranlibs write to current directory, and this might not always be
 # possible (e.g. if installing as root).
 
-install-binaries: $(TK_LIB_FILE) wish
+install-binaries: $(TK_LIB_FILE) $(TK_STATIC_LIB_FILE) wish
 	@for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
 	    do \
 	    if [ ! -d $$i ] ; then \
@@ -395,13 +414,22 @@
 	@$(INSTALL_DATA) $(TK_LIB_FILE) $(LIB_INSTALL_DIR)/$(TK_LIB_FILE)
 	@(cd $(LIB_INSTALL_DIR); $(RANLIB) $(TK_LIB_FILE))
 	@chmod 555 $(LIB_INSTALL_DIR)/$(TK_LIB_FILE)
+.if ${PORTOBJFORMAT}X == elfX
+	@(cd $(LIB_INSTALL_DIR); ln -sf ${TK_LIB_FILE} `echo ${TK_LIB_FILE} | sed 's/\.so.*$$/.so/'`)
+.endif
+	@echo "Installing $(TK_STATIC_LIB_FILE)"
+	@$(INSTALL_DATA) $(TK_STATIC_LIB_FILE) $(LIB_INSTALL_DIR)/$(TK_STATIC_LIB_FILE)
+	@(cd $(LIB_INSTALL_DIR); $(RANLIB) $(TK_STATIC_LIB_FILE))
+	@chmod 555 $(LIB_INSTALL_DIR)/$(TK_STATIC_LIB_FILE)
 	@echo "Installing wish"
 	@$(INSTALL_PROGRAM) wish $(BIN_INSTALL_DIR)/wish$(VERSION)
 	@echo "Installing tkConfig.sh"
-	@$(INSTALL_DATA) tkConfig.sh $(LIB_INSTALL_DIR)/tkConfig.sh
+	@mkdir -p $(LIB_INSTALL_DIR)/tk$(VERSION)
+	@$(INSTALL_DATA) tkConfig.sh $(LIB_INSTALL_DIR)/tk$(VERSION)/tkConfig.sh
 
 install-libraries:
 	@for i in $(INSTALL_ROOT)$(prefix)/lib $(INCLUDE_INSTALL_DIR) \
+		$(GENERIC_INCLUDE_INSTALL_DIR) $(UNIX_INCLUDE_INSTALL_DIR) \
 		$(SCRIPT_INSTALL_DIR) $(SCRIPT_INSTALL_DIR)/images; \
 	    do \
 	    if [ ! -d $$i ] ; then \
@@ -411,8 +439,18 @@
 		else true; \
 		fi; \
 	    done;
-	@echo "Installing tk.h"
-	@$(INSTALL_DATA) $(GENERIC_DIR)/tk.h $(INCLUDE_INSTALL_DIR)/tk.h
+	@echo "Installing headers"
+	@for i in $(GENERIC_DIR)/*.h ; \
+	    do \
+	    echo "Installing $$i"; \
+	    $(INSTALL_DATA) $$i $(GENERIC_INCLUDE_INSTALL_DIR); \
+	    done;
+	@for i in $(UNIX_DIR)/*.h ; \
+	    do \
+	    echo "Installing $$i"; \
+	    $(INSTALL_DATA) $$i $(UNIX_INCLUDE_INSTALL_DIR); \
+	    done;
+	@ln -sf $(GENERIC_INCLUDE_INSTALL_DIR)/tk.h $(INCLUDE_INSTALL_DIR)/tk.h
 	for i in $(SRC_DIR)/library/*.tcl $(SRC_DIR)/library/tclIndex $(SRC_DIR)/library/prolog.ps $(UNIX_DIR)/tkAppInit.c; \
 	    do \
 	    echo "Installing $$i"; \
@@ -482,6 +520,7 @@
 	    chmod 755 $(SCRIPT_INSTALL_DIR)/demos.jp/$$i; \
 	    done;
 	(cd $(SCRIPT_INSTALL_DIR)/demos.jp; \
+	    rm -f *.orig; \
 	    rm -rf images; \
 	    ln -s $(SCRIPT_INSTALL_DIR)/demos/images .)
 
@@ -498,10 +537,10 @@
 	@cd $(SRC_DIR)/doc; for i in *.1; \
 	    do \
 	    echo "Installing doc/$$i"; \
-	    rm -f $(MAN1_INSTALL_DIR)/$$i; \
+	    rm -f $(MAN1_INSTALL_DIR)/$$i $(MAN1_INSTALL_DIR)/$$i.gz; \
 	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
-		    $$i > $(MAN1_INSTALL_DIR)/$$i; \
-	    chmod 444 $(MAN1_INSTALL_DIR)/$$i; \
+		    $$i | gzip -c > $(MAN1_INSTALL_DIR)/$$i.gz; \
+	    chmod 444 $(MAN1_INSTALL_DIR)/$$i.gz; \
 	    done;
 	$(UNIX_DIR)/mkLinks $(MAN1_INSTALL_DIR)
 	@cd $(SRC_DIR)/doc; for i in *.3; \
@@ -509,19 +548,26 @@
 	    echo "Installing doc/$$i"; \
 	    rm -f $(MAN3_INSTALL_DIR)/$$i; \
 	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
-		    $$i > $(MAN3_INSTALL_DIR)/$$i; \
-	    chmod 444 $(MAN3_INSTALL_DIR)/$$i; \
+		    $$i |gzip -c > $(MAN3_INSTALL_DIR)/$$i.gz; \
+	    chmod 444 $(MAN3_INSTALL_DIR)/$$i.gz; \
 	    done;
 	$(UNIX_DIR)/mkLinks $(MAN3_INSTALL_DIR)
 	@cd $(SRC_DIR)/doc; for i in *.n; \
 	    do \
 	    echo "Installing doc/$$i"; \
-	    rm -f $(MANN_INSTALL_DIR)/$$i; \
+	    rm -f $(MANN_INSTALL_DIR)/$$i $(MANN_INSTALL_DIR)/$$i.gz; \
 	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
-		    $$i > $(MANN_INSTALL_DIR)/$$i; \
-	    chmod 444 $(MANN_INSTALL_DIR)/$$i; \
+		    $$i | gzip -c > $(MANN_INSTALL_DIR)/$$i.gz; \
+	    chmod 444 $(MANN_INSTALL_DIR)/$$i.gz; \
 	    done;
 	$(UNIX_DIR)/mkLinks $(MANN_INSTALL_DIR)
+	@echo "**********"
+	@echo "IMPORTANT:"
+	@echo "**********"
+	@echo "tkConfig.sh in $(SCRIPT_INSTALL_DIR)/tkConfig.sh"
+	@echo "tk.h        in $(INCLUDE_INSTALL_DIR)/tk.h"
+	@echo "There are NOT default place, but good place to avoid"
+	@echo "conflicting with another version of Tcl/Tks."
 
 Makefile: $(UNIX_DIR)/Makefile.in
 	$(SHELL) config.status
