$OpenBSD: patch-unix_Makefile_in,v 1.2 2008/10/01 19:47:40 steven Exp $
--- unix/Makefile.in.orig	Thu Aug 14 13:31:38 2008
+++ unix/Makefile.in	Wed Aug 27 02:25:06 2008
@@ -80,6 +80,9 @@ HTML_DIR		= @HTML_DIR@
 # Directory in which to install html documentation:
 HTML_INSTALL_DIR	= $(INSTALL_ROOT)$(HTML_DIR)
 
+# Directory in which to install the configuration file tclConfig.sh:
+CONFIG_INSTALL_DIR	= $(INSTALL_ROOT)$(libdir)
+
 # Package search path.
 TCL_PACKAGE_PATH	= @TCL_PACKAGE_PATH@
 
@@ -554,6 +557,10 @@ ${STUB_LIB_FILE}: ${STUB_LIB_OBJS}
 	rm -f $@
 	@MAKE_STUB_LIB@
 
+${TCL_BUILD_EXP_FILE}: ${OBJS}
+	rm -f $@
+	${STLIB_LD} $@ ${OBJS} ; ${RANLIB} $@
+
 # Make target which outputs the list of the .o contained in the Tcl lib useful
 # to build a single big shared library containing Tcl and other extensions.
 # Used for the Tcl Plugin.  -- dl
@@ -711,30 +718,26 @@ install-strip:
 # (e.g. if installing as root).
 
 install-binaries: binaries
-	@for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" ; \
+	@for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" "$(CONFIG_INSTALL_DIR)"; \
 	    do \
 	    if [ ! -d "$$i" ] ; then \
 		echo "Making directory $$i"; \
-		mkdir -p "$$i"; \
-		chmod 755 "$$i"; \
+		$(INSTALL_DATA_DIR) "$$i"; \
 		else true; \
 		fi; \
 	    done;
-	@if test ! -x $(SRC_DIR)/../unix/install-sh; then \
-	    chmod +x $(SRC_DIR)/../unix/install-sh; \
-	    fi
 	@echo "Installing $(LIB_FILE) to $(LIB_INSTALL_DIR)/"
 	@@INSTALL_LIB@
-	@chmod 555 "$(LIB_INSTALL_DIR)"/$(LIB_FILE)
 	@if test "$(TCL_BUILD_EXP_FILE)" != ""; then \
 	    echo "Installing $(TCL_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \
 	    $(INSTALL_DATA) $(TCL_BUILD_EXP_FILE) \
 			"$(LIB_INSTALL_DIR)"/$(TCL_EXP_FILE); \
+	    (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(TCL_EXP_FILE)); \
 	    fi
 	@echo "Installing tclsh as $(BIN_INSTALL_DIR)/tclsh$(VERSION)"
 	@$(INSTALL_PROGRAM) tclsh "$(BIN_INSTALL_DIR)"/tclsh$(VERSION)
-	@echo "Installing tclConfig.sh to $(LIB_INSTALL_DIR)/"
-	@$(INSTALL_DATA) tclConfig.sh "$(LIB_INSTALL_DIR)"/tclConfig.sh
+	@echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/"
+	@$(INSTALL_DATA) tclConfig.sh "$(CONFIG_INSTALL_DIR)"/tclConfig.sh
 	@if test "$(STUB_LIB_FILE)" != "" ; then \
 	    echo "Installing $(STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \
 	    @INSTALL_STUB_LIB@ ; \
@@ -742,12 +745,12 @@ install-binaries: binaries
 	@EXTRA_INSTALL_BINARIES@
 
 install-libraries: libraries $(INSTALL_TZDATA) install-msgs
-	@for i in "$(INCLUDE_INSTALL_DIR)" "$(SCRIPT_INSTALL_DIR)"; \
+	@for i in "$(INCLUDE_INSTALL_DIR)" "$(SCRIPT_INSTALL_DIR)" \
+		"$(INCLUDE_INSTALL_DIR)"/generic "$(INCLUDE_INSTALL_DIR)"/unix; \
 	    do \
 	    if [ ! -d "$$i" ] ; then \
 		echo "Making directory $$i"; \
-		mkdir -p "$$i"; \
-		chmod 755 "$$i"; \
+		$(INSTALL_DATA_DIR) "$$i"; \
 		else true; \
 		fi; \
 	    done;
@@ -755,14 +758,10 @@ install-libraries: libraries $(INSTALL_TZDATA) install
 	    do \
 	    if [ ! -d "$(SCRIPT_INSTALL_DIR)"/$$i ] ; then \
 		echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \
-		mkdir -p "$(SCRIPT_INSTALL_DIR)"/$$i; \
-		chmod 755 "$(SCRIPT_INSTALL_DIR)"/$$i; \
+		$(INSTALL_DATA_DIR) "$(SCRIPT_INSTALL_DIR)"/$$i; \
 		else true; \
 		fi; \
 	    done;
-	@if test ! -x $(SRC_DIR)/../unix/install-sh; then \
-	    chmod +x $(SRC_DIR)/../unix/install-sh; \
-	    fi
 	@echo "Installing header files";
 	@for i in $(GENERIC_DIR)/tcl.h $(GENERIC_DIR)/tclDecls.h \
 		$(GENERIC_DIR)/tclPlatDecls.h \
@@ -770,10 +769,21 @@ install-libraries: libraries $(INSTALL_TZDATA) install
 		$(GENERIC_DIR)/tclTomMathDecls.h ; \
 	    do \
 	    $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)"; \
+	    cd "$(INCLUDE_INSTALL_DIR)"/generic && ln -sf ../`basename $$i` ./`basename $$i`; \
 	    done;
+	@for i in $(GENERIC_DIR)/tclInt.h $(GENERIC_DIR)/tclIntDecls.h \
+		$(GENERIC_DIR)/tclIntPlatDecls.h \
+		$(GENERIC_DIR)/tclPort.h ; \
+	    do \
+	    $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)"/generic; \
+	    done;
+	@for i in $(UNIX_DIR)/tclUnixPort.h; \
+	    do \
+	    $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)"/unix; \
+	    done;
 	@echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
 	@for i in $(TOP_DIR)/library/*.tcl $(TOP_DIR)/library/tclIndex \
-		$(UNIX_DIR)/tclAppInit.c $(UNIX_DIR)/ldAix @DTRACE_SRC@; \
+		$(UNIX_DIR)/tclAppInit.c @LDAIX_SRC@ @DTRACE_SRC@; \
 	    do \
 	    $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \
 	    done;
@@ -831,8 +841,7 @@ install-doc: doc
 	    do \
 	    if [ ! -d "$$i" ] ; then \
 		echo "Making directory $$i"; \
-		mkdir -p "$$i"; \
-		chmod 755 "$$i"; \
+		$(INSTALL_DATA_DIR) "$$i"; \
 		else true; \
 		fi; \
 	    done;
