diff -urN tk4.0.orig/Makefile.in tk4.0/Makefile.in
--- tk4.0.orig/Makefile.in	Fri Jun 30 13:20:26 1995
+++ tk4.0/Makefile.in	Fri Jun 30 21:13:22 1995
@@ -11,6 +11,12 @@
 
 VERSION = 4.0
 
+SHARED = true
+ifeq ($(SHARED),true)
+SHVERSION = 1
+SHCFLAGS = -fPIC
+endif
+
 #----------------------------------------------------------------
 # Things you can change to personalize the Makefile for your own
 # site (you can make these changes in either Makefile.in or
@@ -52,21 +58,24 @@
 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/tcl
 
 # Top-level directory for manual entries:
 MAN_INSTALL_DIR =	$(INSTALL_ROOT)$(prefix)/man
 
 # Directory in which to install manual entry for wish:
 MAN1_INSTALL_DIR =	$(MAN_INSTALL_DIR)/man1
+MAN1_EXT = 1tk
 
 # Directory in which to install manual entries for Tk's C library
 # procedures:
 MAN3_INSTALL_DIR =	$(MAN_INSTALL_DIR)/man3
+MAN3_EXT = 3tk
 
 # Directory in which to install manual entries for the built-in
 # Tcl commands implemented by Tk:
-MANN_INSTALL_DIR =	$(MAN_INSTALL_DIR)/mann
+MANN_INSTALL_DIR =	$(MAN_INSTALL_DIR)/man3
+MANN_EXT = 3tk
 
 # The directory containing the Tcl sources and headers appropriate
 # for this version of Tk ("srcdir" will be replaced or has already
@@ -92,11 +101,11 @@
 # and the math library (in that order).  The "LIBS" part will be
 # replaced (or has already been replaced) with relevant libraries as
 # determined by the configure script.
-LIBS = libtk.a $(TCL_BIN_DIR)/libtcl.a $(X11_LIB_SWITCHES) @LIBS@ @MATH_LIBS@
+LIBS = -L. -ltk -L$(TCL_BIN_DIR) -ltcl $(X11_LIB_SWITCHES) @LIBS@ @MATH_LIBS@
 
 # To change the compiler switches, for example to change from -O
 # to -g, change the following line:
-CFLAGS = -O
+CFLAGS = -O2
 
 # To turn off the security checks that disallow incoming sends when
 # the X server appears to be insecure, reverse the comments on the
@@ -141,7 +150,7 @@
 #----------------------------------------------------------------
 
 AC_FLAGS =		@DEFS@
-INSTALL_PROGRAM =	@INSTALL_PROGRAM@
+INSTALL_PROGRAM =	@INSTALL_PROGRAM@ -s
 INSTALL_DATA =		@INSTALL_DATA@
 RANLIB =		@RANLIB@
 SRC_DIR =		@srcdir@
@@ -157,7 +166,7 @@
 CC =		@CC@
 CC_SWITCHES =	${CFLAGS} -I${SRC_DIR} -I${TCL_DIR} ${X11_INCLUDES} \
 ${AC_FLAGS} ${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} \
-${KEYSYM_FLAGS} -DTK_LIBRARY=\"${TK_LIBRARY}\"
+${KEYSYM_FLAGS} -DTK_LIBRARY=\"${TK_LIBRARY}\" $(SHCFLAGS)
 
 WIDGOBJS = tkButton.o tkEntry.o tkFrame.o tkListbox.o \
 	tkMenu.o tkMenubutton.o tkMessage.o tkScale.o \
@@ -207,6 +216,10 @@
 	rm -f libtk.a
 	ar cr libtk.a $(OBJS)
 	$(RANLIB) libtk.a
+ifeq ($(SHARED),true)
+	$(CC) -shared -o libtk.so.$(SHVERSION) -Wl,-soname,libtk.so.$(SHVERSION).$(VERSION) $(OBJS)
+	ln -sf libtk.so.$(SHVERSION).$(VERSION) libtk.so.$(SHVERSION)
+endif
 
 wish: tkAppInit.o libtk.a $(TCL_BIN_DIR)/libtcl.a
 	$(CC) $(CC_SWITCHES) tkAppInit.o $(LIBS) -o wish
@@ -217,7 +230,9 @@
 test: tktest
 	@cwd=`pwd`; \
 	cd $(TCL_DIR); TCL_LIBRARY=`pwd`/library; export TCL_LIBRARY; \
+	export LD_LIBRARY_PATH=`pwd`:$$LD_LIBRARY_PATH; \
 	cd $$cwd; cd $(SRC_DIR); TK_LIBRARY=`pwd`/library; export TK_LIBRARY; \
+	export LD_LIBRARY_PATH=`pwd`:$$LD_LIBRARY_PATH; \
 	cd $$cwd; ( echo cd $(SRC_DIR)/tests\; source all\; exit ) | ./tktest
 
 configInfo: Makefile
@@ -243,12 +258,19 @@
 	@echo "Installing libtk.a"
 	@$(INSTALL_DATA) libtk.a $(LIB_INSTALL_DIR)/libtk$(VERSION).a
 	@$(RANLIB) $(LIB_INSTALL_DIR)/libtk$(VERSION).a
+ifeq ($(SHARED),true)
+	@echo "Installing libtk.so"
+	@$(INSTALL_PROGRAM) libtk.so.$(SHVERSION).$(VERSION) $(LIB_INSTALL_DIR)/libtk.so.$(SHVERSION).$(VERSION)
+	@echo "Running ldconfig"
+	-@/sbin/ldconfig
+endif
 	@echo "Installing wish"
 	@$(INSTALL_PROGRAM) wish $(BIN_INSTALL_DIR)/wish$(VERSION)
+	@ln -sf wish$(VERSION) $(BIN_INSTALL_DIR)/wish
 
 install-libraries:
-	@for i in $(INSTALL_ROOT)$(prefix)/lib $(INCLUDE_INSTALL_DIR) \
-		$(SCRIPT_INSTALL_DIR) ; \
+	@for i in $(INSTALL_ROOT)$(prefix)/include $(INSTALL_ROOT)$(prefix)/lib \
+		$(INCLUDE_INSTALL_DIR) $(SCRIPT_INSTALL_DIR) ; \
 	    do \
 	    if [ ! -d $$i ] ; then \
 		echo "Making directory $$i"; \
@@ -257,8 +279,11 @@
 		else true; \
 		fi; \
 	    done;
-	@echo "Installing tk.h"
-	@$(INSTALL_DATA) $(SRC_DIR)/tk.h $(INCLUDE_INSTALL_DIR)
+	@for i in tk.h tkInt.h tkCanvas.h tkPort.h tkText.h default.h ks_names.h; \
+	    do \
+	    echo "Installing $$i"; \
+	    $(INSTALL_DATA) $(SRC_DIR)/$$i $(INCLUDE_INSTALL_DIR); \
+	    done;
 	for i in $(SRC_DIR)/library/*.tcl $(SRC_DIR)/library/tclIndex $(SRC_DIR)/library/prolog.ps $(SRC_DIR)/tkAppInit.c; \
 	    do \
 	    echo "Installing $$i"; \
@@ -309,37 +334,42 @@
 	@cd $(SRC_DIR)/doc; for i in *.1; \
 	    do \
 	    echo "Installing doc/$$i"; \
-	    rm -f $(MAN1_INSTALL_DIR)/$$i; \
+	    page=`basename $$i .1`.$(MAN1_EXT); \
+	    rm -f $(MAN1_INSTALL_DIR)/$$page; \
 	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
-		    $$i > $(MAN1_INSTALL_DIR)/$$i; \
-	    chmod 444 $(MAN1_INSTALL_DIR)/$$i; \
+		    $$i > $(MAN1_INSTALL_DIR)/$$page; \
+	    chmod 644 $(MAN1_INSTALL_DIR)/$$page; \
 	    done;
 	@cd $(SRC_DIR)/doc; for i in *.3; \
 	    do \
 	    echo "Installing doc/$$i"; \
-	    rm -f $(MAN3_INSTALL_DIR)/$$i; \
+	    page=`basename $$i .3`.$(MAN3_EXT); \
+	    rm -f $(MAN3_INSTALL_DIR)/$$page; \
 	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
-		    $$i > $(MAN3_INSTALL_DIR)/$$i; \
-	    chmod 444 $(MAN3_INSTALL_DIR)/$$i; \
+		    $$i > $(MAN3_INSTALL_DIR)/$$page; \
+	    chmod 644 $(MAN3_INSTALL_DIR)/$$page; \
 	    done;
+	@sh @srcdir@/fixman3.sh $(MAN3_INSTALL_DIR) $(MAN3_EXT)
 	@cd $(SRC_DIR)/doc; for i in *.n; \
 	    do \
 	    echo "Installing doc/$$i"; \
-	    rm -f $(MANN_INSTALL_DIR)/$$i; \
+	    page=`basename $$i .n`.$(MANN_EXT); \
+	    rm -f $(MANN_INSTALL_DIR)/$$page; \
 	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
-		    $$i > $(MANN_INSTALL_DIR)/$$i; \
-	    chmod 444 $(MANN_INSTALL_DIR)/$$i; \
+		    $$i > $(MANN_INSTALL_DIR)/$$page; \
+	    chmod 644 $(MANN_INSTALL_DIR)/$$page; \
 	    done;
+	@sh @srcdir@/fixmann.sh $(MANN_INSTALL_DIR) $(MANN_EXT)
 
 Makefile: $(SRC_DIR)/Makefile.in
 	$(SHELL) config.status
 
 clean:
-	rm -f *.a *.o core errs *~ \#* TAGS *.E a.out errors tktest wish \
+	rm -f *.a *.so *.so.* *.o core errs *~ \#* TAGS *.E a.out errors tktest wish \
 		config.info
 
 distclean: clean
-	rm -f Makefile config.status config.cache
+	rm -f Makefile config.status config.cache config.log
 
 depend:
 	makedepend -- $(CC_SWITCHES) -- $(SRCS)
diff -urN tk4.0.orig/README.linux tk4.0/README.linux
--- tk4.0.orig/README.linux	Wed Dec 31 18:00:00 1969
+++ tk4.0/README.linux	Fri Jun 30 21:12:54 1995
@@ -0,0 +1,27 @@
+Linux-Related Changes:
+
+  Support for ELF shared libraries.
+  Install manual pages under all relevant names.
+
+Required Packages (later versions should also work):
+
+  gcc-2.6.3 (ELF)
+  binutils-2.5.2l.17
+  libc-5.0.9
+  make-3.71
+  ld.so-1.7.4
+  Tcl7.4
+
+How to Build and Install:
+
+  ./configure   (optionally specify your favorite --prefix= option)
+  make
+  make install
+
+In Case of Problems:
+
+  Send email to the address listed below.  It may take me a while
+  sometimes, but I will answer eventually.
+
+David Engel
+david@ods.com
diff -urN tk4.0.orig/fixman3.sh tk4.0/fixman3.sh
--- tk4.0.orig/fixman3.sh	Wed Dec 31 18:00:00 1969
+++ tk4.0/fixman3.sh	Fri Jun 30 21:10:59 1995
@@ -0,0 +1,102 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then
+	echo usage: $0 directory extension
+	exit 1
+fi
+
+if ! cd $1; then
+	echo $0: can not cd to $1
+	exit 1
+fi
+
+ext=$2
+
+function fixman {
+	if [ $# -lt 2 ]; then
+		echo fixman: called with too few args
+		exit 1
+	fi
+
+	local base=$1
+	shift 1
+
+	for f in $*; do
+		if ! ln -sf $base.$ext $f.$ext; then
+			echo fixman: cant ln $base.$ext to $f.$ext
+		fi
+	done
+}
+
+fixman 3DBorder Tk_Get3DBorder Tk_Draw3DRectangle Tk_Fill3DRectangle Tk_Draw3DPolygon Tk_Fill3DPolygon Tk_3DVerticalBevel Tk_3DHorizontalBevel Tk_SetBackgroundFromBorder Tk_NameOf3DBorder Tk_3DBorderColor Tk_3DBorderGC Tk_Free3DBorder
+fixman BackgdErr Tk_BackgroundError
+fixman BindTable Tk_CreateBindingTable Tk_DeleteBindingTable Tk_CreateBinding Tk_DeleteBinding Tk_GetBinding Tk_GetAllBindings Tk_DeleteAllBindings Tk_BindEvent
+fixman CanvPsY Tk_CanvasPsY Tk_CanvasPsBitmap Tk_CanvasPsColor Tk_CanvasPsFont Tk_CanvasPsPath Tk_CanvasPsStipple
+fixman CanvTkwin Tk_CanvasTkwin Tk_CanvasGetCoord Tk_CanvasDrawableCoords Tk_CanvasSetStippleOrigin Tk_CanvasWindowCoords Tk_CanvasEventuallyRedraw
+fixman CanvTxtInfo Tk_CanvasTextInfo
+fixman Clipboard Tk_ClipboardClear Tk_ClipboardAppend
+fixman ClrSelect Tk_ClearSelection
+fixman ConfigWidg Tk_ConfigureWidget Tk_Offset Tk_ConfigureInfo Tk_ConfigureValue Tk_FreeOptions
+fixman ConfigWind Tk_ConfigureWindow Tk_MoveWindow Tk_ResizeWindow Tk_MoveResizeWindow Tk_SetWindowBorderWidth Tk_ChangeWindowAttributes Tk_SetWindowBackground Tk_SetWindowBackgroundPixmap Tk_SetWindowBorder Tk_SetWindowBorderPixmap Tk_SetWindowColormap Tk_DefineCursor Tk_UndefineCursor
+fixman CoordToWin Tk_CoordsToWindow
+fixman CrtErrHdlr Tk_CreateErrorHandler Tk_DeleteErrorHandler
+fixman CrtGenHdlr Tk_CreateGenericHandler Tk_DeleteGenericHandler
+fixman CrtImgType Tk_CreateImageType
+fixman CrtItemType Tk_CreateItemType Tk_GetItemTypes
+fixman CrtMainWin Tk_CreateMainWindow Tk_CreateWindow Tk_CreateWindowFromPath Tk_DestroyWindow Tk_MakeWindowExist
+fixman CrtPhImgFmt Tk_CreatePhotoImageFormat
+fixman CrtSelHdlr Tk_CreateSelHandler Tk_DeleteSelHandler
+fixman DeleteImg Tk_DeleteImage
+fixman DoOneEvent Tk_DoOneEvent Tk_MainLoop Tk_HandleEvent
+fixman DoWhenIdle Tk_DoWhenIdle Tk_CancelIdleCall
+fixman DrawFocHlt Tk_DrawFocusHighlight
+fixman EventHndlr Tk_CreateEventHandler Tk_DeleteEventHandler
+fixman EventInit Tk_EventInit
+fixman FileHndlr Tk_CreateFileHandler Tk_CreateFileHandler2 Tk_DeleteFileHandler
+fixman FindPhoto Tk_FindPhoto Tk_PhotoPutBlock Tk_PhotoPutZoomedBlock Tk_PhotoGetImage Tk_PhotoBlank Tk_PhotoExpand Tk_PhotoGetSize Tk_PhotoSetSize
+fixman FreeXId Tk_FreeXId
+fixman GeomReq Tk_GeometryRequest Tk_SetInternalBorder
+fixman GetAnchor Tk_GetAnchor Tk_NameOfAnchor
+fixman GetBitmap Tk_GetBitmap Tk_DefineBitmap Tk_NameOfBitmap Tk_SizeOfBitmap Tk_FreeBitmap Tk_GetBitmapFromData
+fixman GetCapStyl Tk_GetCapStyle Tk_NameOfCapStyle
+fixman GetClrmap Tk_GetColormap Tk_FreeColormap
+fixman GetColor Tk_GetColor Tk_GetColorByValue Tk_NameOfColor Tk_FreeColor
+fixman GetCursor Tk_GetCursor Tk_GetCursorFromData Tk_NameOfCursor Tk_FreeCursor
+fixman GetFontStr Tk_GetFontStruct Tk_NameOfFontStruct Tk_FreeFontStruct
+fixman GetGC Tk_GetGC Tk_FreeGC
+fixman GetImage Tk_GetImage Tk_RedrawImage Tk_SizeOfImage Tk_FreeImage
+fixman GetJoinStl Tk_GetJoinStyle Tk_NameOfJoinStyle
+fixman GetJustify Tk_GetJustify Tk_NameOfJustify
+fixman GetOption Tk_GetOption
+fixman GetPixels Tk_GetPixels Tk_GetScreenMM
+fixman GetPixmap Tk_GetPixmap Tk_FreePixmap
+fixman GetRelief Tk_GetRelief Tk_NameOfRelief
+fixman GetRootCrd Tk_GetRootCoords
+fixman GetScroll Tk_GetScrollInfo
+fixman GetSelect Tk_GetSelection
+fixman GetUid Tk_GetUid Tk_Uid
+fixman GetVRoot Tk_GetVRootGeometry
+fixman GetVisual Tk_GetVisual
+fixman IdToWindow Tk_IdToWindow
+fixman ImgChanged Tk_ImageChanged
+fixman InternAtom Tk_InternAtom Tk_GetAtomName
+fixman MainWin Tk_MainWindow
+fixman MaintGeom Tk_MaintainGeometry Tk_UnmaintainGeometry
+fixman ManageGeom Tk_ManageGeometry
+fixman MapWindow Tk_MapWindow Tk_UnmapWindow
+fixman MoveToplev Tk_MoveToplevelWindow
+fixman Name Tk_Name Tk_PathName Tk_NameToWindow
+fixman NameOfImg Tk_NameOfImage
+fixman OwnSelect Tk_OwnSelection
+fixman ParseArgv Tk_ParseArgv
+fixman Preserve Tk_Preserve Tk_Release Tk_EventuallyFree
+fixman Restack Tk_RestackWindow
+fixman RestrictEv Tk_RestrictEvents
+fixman SetAppName Tk_SetAppName
+fixman SetClass Tk_SetClass Tk_Class
+fixman SetGrid Tk_SetGrid Tk_UnsetGrid
+fixman SetVisual Tk_SetWindowVisual
+fixman Sleep Tk_Sleep
+fixman StrictMotif Tk_StrictMotif
+fixman TimerHndlr Tk_CreateTimerHandler Tk_DeleteTimerHandler
+fixman WindowId Tk_WindowId Tk_Parent Tk_Display Tk_DisplayName Tk_ScreenNumber Tk_Screen Tk_X Tk_Y Tk_Width Tk_Height Tk_Changes Tk_Attributes Tk_IsMapped Tk_IsTopLevel Tk_ReqWidth Tk_ReqHeight Tk_InternalBorderWidth Tk_Visual Tk_Depth Tk_Colormap
diff -urN tk4.0.orig/fixmann.sh tk4.0/fixmann.sh
--- tk4.0.orig/fixmann.sh	Wed Dec 31 18:00:00 1969
+++ tk4.0/fixmann.sh	Fri Jun 30 21:10:59 1995
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then
+	echo usage: $0 directory extension
+	exit 1
+fi
+
+if ! cd $1; then
+	echo $0: can not cd to $1
+	exit 1
+fi
+
+ext=$2
+
+function fixman {
+	if [ $# -lt 2 ]; then
+		echo fixman: called with too few args
+		exit 1
+	fi
+
+	local base=$1
+	shift 1
+
+	for f in $*; do
+		if ! ln -sf $base.$ext $f.$ext; then
+			echo fixman: cant ln $base.$ext to $f.$ext
+		fi
+	done
+}
+
+fixman dialog tk_dialog
+fixman focusNext tk_focusNext tk_focusPrev tk_focusFollowsMouse
+fixman menubar tk_menuBar tk_bindForTraversal
+fixman optionMenu tk_optionMenu
+fixman popup tk_popup
+fixman tkvars tk_library tk_patchLevel tkPriv tk_strictMotif tk_version
diff -urN tk4.0.orig/tkAppInit.c tk4.0/tkAppInit.c
--- tk4.0.orig/tkAppInit.c	Wed Jun 28 15:14:31 1995
+++ tk4.0/tkAppInit.c	Fri Jun 30 21:10:59 1995
@@ -22,8 +22,10 @@
  * Sun shared libraries to be used for Tcl.
  */
 
+#ifdef NEED_MATHERR
 extern int matherr();
 int *tclDummyMathPtr = (int *) matherr;
+#endif
 
 /*
  *----------------------------------------------------------------------
diff -urN tk4.0.orig/tkTest.c tk4.0/tkTest.c
--- tk4.0.orig/tkTest.c	Thu Jun  8 13:43:05 1995
+++ tk4.0/tkTest.c	Fri Jun 30 21:10:59 1995
@@ -23,8 +23,10 @@
  * Sun shared libraries to be used for Tcl.
  */
 
+#ifdef NEED_MATHERR
 extern int matherr();
 int *tclDummyMathPtr = (int *) matherr;
+#endif
 
 /*
  * The table below describes events and is used by the "testevent"
