summaryrefslogtreecommitdiff
path: root/tk/unix
diff options
context:
space:
mode:
Diffstat (limited to 'tk/unix')
-rw-r--r--tk/unix/ChangeLog30
-rw-r--r--tk/unix/Makefile.in486
-rw-r--r--tk/unix/README62
-rw-r--r--tk/unix/aclocal.m42
-rwxr-xr-xtk/unix/configure3201
-rwxr-xr-xtk/unix/configure.in400
-rwxr-xr-xtk/unix/mkLinks895
-rw-r--r--tk/unix/porting.old324
-rw-r--r--tk/unix/tcl.m41882
-rw-r--r--tk/unix/tkAppInit.c39
-rw-r--r--tk/unix/tkConfig.sh.in26
-rw-r--r--tk/unix/tkUnix.c32
-rw-r--r--tk/unix/tkUnix3d.c92
-rw-r--r--tk/unix/tkUnixButton.c48
-rw-r--r--tk/unix/tkUnixColor.c1
-rw-r--r--tk/unix/tkUnixConfig.c46
-rw-r--r--tk/unix/tkUnixCursor.c18
-rw-r--r--tk/unix/tkUnixDefault.h13
-rw-r--r--tk/unix/tkUnixDialog.c8
-rw-r--r--tk/unix/tkUnixDraw.c37
-rw-r--r--tk/unix/tkUnixEmbed.c60
-rw-r--r--tk/unix/tkUnixEvent.c111
-rw-r--r--tk/unix/tkUnixFocus.c2
-rw-r--r--tk/unix/tkUnixFont.c2788
-rw-r--r--tk/unix/tkUnixInit.c11
-rw-r--r--tk/unix/tkUnixInt.h14
-rw-r--r--tk/unix/tkUnixKey.c355
-rw-r--r--tk/unix/tkUnixMenu.c454
-rw-r--r--tk/unix/tkUnixMenubu.c12
-rw-r--r--tk/unix/tkUnixPort.h8
-rw-r--r--tk/unix/tkUnixScale.c260
-rw-r--r--tk/unix/tkUnixScrlbr.c1
-rw-r--r--tk/unix/tkUnixSelect.c566
-rw-r--r--tk/unix/tkUnixSend.c115
-rw-r--r--tk/unix/tkUnixWm.c458
-rw-r--r--tk/unix/tkUnixXId.c8
36 files changed, 9782 insertions, 3083 deletions
diff --git a/tk/unix/ChangeLog b/tk/unix/ChangeLog
index edb93447c0a..ddf2006c3ab 100644
--- a/tk/unix/ChangeLog
+++ b/tk/unix/ChangeLog
@@ -1,33 +1,3 @@
-Mon Aug 30 12:41:17 1999 Jeffrey A Law (law@cygnus.com)
-
- * configure.in: Do not force static linking for hpux11 in wide
- mode since no static X libraries exist.
- * configure: Rebuilt.
-
-Wed Jan 6 13:45:20 1999 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
-
- * configure.in (TK_SHARED_LIB_FILE): init to dummy name.
- (TK_UNSHARED_LIB_FILE): ditto.
-
- * configure: regenerated.
-
-Thu Jul 9 14:35:35 1998 Felix Lee <flee@cygnus.com>
-
- * configure.in: typo.
- * configure: rebuild.
-
-Tue Jul 7 16:59:07 1998 Felix Lee <flee@cygnus.com>
-
- * configure.in: Undo previous change, which didn't work right.
- Add specialcase to make static link of X work on solaris.
- * configure: Rebuild.
-
-Wed Jun 17 11:40:56 1998 Felix Lee <flee@cygnus.com>
-
- * configure.in: When looking for the X libraries, set LDFLAGS to
- find them statically if that is how we are going to link.
- * configure: Rebuild.
-
Mon Apr 13 17:55:38 1998 Ian Lance Taylor <ian@cygnus.com>
* configure.in: Remove AC_REPLACE_FUNCS(memmove).
diff --git a/tk/unix/Makefile.in b/tk/unix/Makefile.in
index d18075684a9..5c80ea51a65 100644
--- a/tk/unix/Makefile.in
+++ b/tk/unix/Makefile.in
@@ -5,12 +5,12 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
-# SCCS: @(#) Makefile.in 1.146 97/11/05 11:10:45
+# RCS: @(#) $Id$
# Current Tk version; used in various names.
-TCLVERSION = @TCL_VERSION@
-VERSION = @TK_VERSION@
+TCLVERSION = @TCL_VERSION@
+VERSION = @TK_VERSION@
#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
@@ -25,15 +25,19 @@ VERSION = @TK_VERSION@
# at configure-time with the --exec-prefix and --prefix options
# to the "configure" script.
-prefix = @prefix@
-exec_prefix = @exec_prefix@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir = @libdir@
+includedir = @includedir@
+mandir = @mandir@
# The following definition can be set to non-null for special systems
# like AFS with replication. It allows the pathnames used for installation
# to be different than those used for actually reference files at
# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
# when installing files.
-INSTALL_ROOT =
+INSTALL_ROOT =
# Directory from which applications will reference the library of Tcl
# scripts (note: you can set the TK_LIBRARY environment variable at
@@ -47,7 +51,7 @@ TK_LIB_TRAILER = /lib/tk$(VERSION)
# END CYGNUS LOCAL
# Path name to use when installing library scripts:
-SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TK_LIBRARY)
+SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)/$(TK_LIBRARY)
# Directory in which to install the .a or .so binary for the Tk library:
LIB_INSTALL_DIR = $(INSTALL_ROOT)@libdir@
@@ -68,68 +72,89 @@ INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)@includedir@
MAN_INSTALL_DIR = $(INSTALL_ROOT)@mandir@
# Directory in which to install manual entry for wish:
-MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1
+MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1
# Directory in which to install manual entries for Tk's C library
# procedures:
-MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3
+MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3
# 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)/mann
# 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):
-TCL_GENERIC_DIR = @TCL_SRC_DIR@/generic
+TCL_GENERIC_DIR = @TCL_SRC_DIR@/generic
# The directory containing the Tcl library archive file appropriate
# for this version of Tk:
-TCL_BIN_DIR = @TCL_BIN_DIR@
+TCL_BIN_DIR = @TCL_BIN_DIR@
+
+# Libraries built with optimization switches have this additional extension
+TK_DBGX = @TK_DBGX@
+
+# warning flags
+CFLAGS_WARNING = @CFLAGS_WARNING@
+
+# The default switches for optimization or debugging
+CFLAGS_DEBUG = @CFLAGS_DEBUG@
+CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@
+
+# To change the compiler switches, for example to change from optimization to
+# debugging symbols, change the following line:
+#CFLAGS = $(CFLAGS_DEBUG)
+#CFLAGS = $(CFLAGS_OPTIMIZE)
+#CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE)
+CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@
+
+# Flags to pass to the linker
+LDFLAGS_DEBUG = @LDFLAGS_DEBUG@
+LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@
+LDFLAGS = @LDFLAGS@ @LDFLAGS_DEFAULT@
# A "-I" switch that can be used when compiling to make all of the
# X11 include files accessible (the configure script will try to
# set this value, and will cause it to be an empty string if the
# include files are accessible via /usr/include).
-X11_INCLUDES = @XINCLUDES@
+X11_INCLUDES = @XINCLUDES@
# Linker switch(es) to use to link with the X11 library archive (the
# configure script will try to set this value automatically, but you
# can override it).
-X11_LIB_SWITCHES = @XLIBSW@
+X11_LIB_SWITCHES = @XLIBSW@
-# 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
-
-# To change the compiler switches, for example to change from -O
-# to -g, change the following line:
-CFLAGS = @CFLAGS@
# To turn off the security checks that disallow incoming sends when
# the X server appears to be insecure, reverse the comments on the
# following lines:
-SECURITY_FLAGS =
-#SECURITY_FLAGS = -DTK_NO_SECURITY
+SECURITY_FLAGS =
+#SECURITY_FLAGS = -DTK_NO_SECURITY
# To disable ANSI-C procedure prototypes reverse the comment characters
# on the following lines:
-PROTO_FLAGS =
-#PROTO_FLAGS = -DNO_PROTOTYPE
+PROTO_FLAGS =
+#PROTO_FLAGS = -DNO_PROTOTYPE
# To enable memory debugging reverse the comment characters on the following
# lines. Warning: if you enable memory debugging, you must do it
# *everywhere*, including all the code that calls Tcl, and you must use
# ckalloc and ckfree everywhere instead of malloc and free.
-MEM_DEBUG_FLAGS =
-#MEM_DEBUG_FLAGS = -DTCL_MEM_DEBUG
+MEM_DEBUG_FLAGS =
+#MEM_DEBUG_FLAGS = -DTCL_MEM_DEBUG
# If your X server is X11R4 or earlier, then you may wish to reverse
# the comment characters on the following two lines. This will enable
# extra code to speed up XStringToKeysym. In X11R5 and later releases
# XStringToKeysym is plenty fast, so you needn't define REDO_KEYSYM_LOOKUP.
-KEYSYM_FLAGS =
-#KEYSYM_FLAGS = -DREDO_KEYSYM_LOOKUP
+KEYSYM_FLAGS =
+#KEYSYM_FLAGS = -DREDO_KEYSYM_LOOKUP
+
+# Tk does not used deprecated Tcl constructs so it should
+# compile fine with -DTCL_NO_DEPRECATED. To remove its own
+# set of deprecated code uncomment the second line.
+NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED
+#NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED
# Some versions of make, like SGI's, use the following variable to
# determine which shell to use for executing commands:
@@ -140,9 +165,16 @@ SHELL = @SHELL@
# "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_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
+INSTALL = @srcdir@/install-sh -c
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA = ${INSTALL} -m 644
+
+# The following specifies which Tcl executable to use for make targets
+# below. This can generally be 'tclsh', meaning all targets will work
+# once we have created the initial executable, but in some cases you
+# may want to use a target without having made tclsh on these sources
+# (like for make genstubs)
+TCL_EXE = tclsh
# The symbols below provide support for dynamic loading and shared
@@ -150,22 +182,42 @@ INSTALL_DATA = ${INSTALL} -m 644
# configure script. You shouldn't normally need to modify any of
# these definitions by hand.
-TK_SHLIB_CFLAGS = @TK_SHLIB_CFLAGS@
+SHLIB_CFLAGS = @SHLIB_CFLAGS@
+
+# To enable support for stubs in Tcl.
+STUB_LIB_FILE = @TK_STUB_LIB_FILE@
+
+TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
+#TK_STUB_LIB_FILE = libtkstub.a
+
+TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
+#TK_STUB_LIB_FLAG = -ltkstub
+
+TK_LIB_FILE = @TK_LIB_FILE@
+#TK_LIB_FILE = libtk.a
-TK_LIB_FILE = @TK_LIB_FILE@
-#TK_LIB_FILE = libtk.a
+TK_LIB_FLAG = @TK_LIB_FLAG@
+#TK_LIB_FLAG = -ltk
-TK_LIB_FLAG = @TK_LIB_FLAG@
-#TK_LIB_FLAG = -ltk
+TCL_BUILD_LIB_SPEC = @TCL_BUILD_LIB_SPEC@
-TCL_LIB_FLAG = @TCL_LIB_FLAG@
-#TCL_LIB_FLAG = -ltcl
+TK_EXP_FILE = @TK_EXP_FILE@
+TK_BUILD_EXP_FILE = @TK_BUILD_EXP_FILE@
+
+TCL_STUB_FLAGS = @TCL_STUB_FLAGS@
+
+# Libraries to use when linking. This definition is determined by the
+# configure script.
+LIBS = @LIBS@ $(X11_LIB_SWITCHES) @DL_LIBS@ @MATH_LIBS@ -lc
+WISH_LIBS = $(TCL_BUILD_LIB_SPEC) @LIBS@ $(X11_LIB_SWITCHES) @DL_LIBS@ @MATH_LIBS@ -lc
# The symbol below provides support for dynamic loading and shared
# libraries. See configure.in for a description of what it means.
# The values of the symbolis normally set by the configure script.
+STLIB_LD = @STLIB_LD@
SHLIB_LD = @SHLIB_LD@
+SHLIB_LD_LIBS = @SHLIB_LD_LIBS@
# CYGNUS LOCAL
# Defines for building libtk
@@ -174,12 +226,17 @@ TCL_SHARED_LIB_SUFFIX = @TCL_SHARED_LIB_SUFFIX@
TCL_UNSHARED_LIB_SUFFIX = @TCL_UNSHARED_LIB_SUFFIX@
TK_SHARED_LIB_FILE = @TK_SHARED_LIB_FILE@
TK_UNSHARED_LIB_FILE = @TK_UNSHARED_LIB_FILE@
+# END CYGNUS LOCAL
+
+SHLIB_LD = @SHLIB_LD@
+SHLIB_LD_LIBS = @SHLIB_LD_LIBS@
+
# Additional search flags needed to find the various shared libraries
# at run-time. The first symbol is for use when creating a binary
# with cc, and the second is for use when running ld directly.
-TK_CC_SEARCH_FLAGS = @TK_CC_SEARCH_FLAGS@
-TK_LD_SEARCH_FLAGS = @TK_LD_SEARCH_FLAGS@
+TK_CC_SEARCH_FLAGS = @TK_CC_SEARCH_FLAGS@
+TK_LD_SEARCH_FLAGS = @TK_LD_SEARCH_FLAGS@
#----------------------------------------------------------------
# The information below is modified by the configure script when
@@ -187,14 +244,15 @@ TK_LD_SEARCH_FLAGS = @TK_LD_SEARCH_FLAGS@
# modify any of this stuff by hand.
#----------------------------------------------------------------
-AC_FLAGS = @DEFS@
-RANLIB = @RANLIB@
-SRC_DIR = @srcdir@/..
-TOP_DIR = @srcdir@/..
-GENERIC_DIR = $(TOP_DIR)/generic
-UNIX_DIR = @srcdir@
-BMAP_DIR = $(TOP_DIR)/bitmaps
-TOOL_DIR = @TCL_SRC_DIR@/tools
+AC_FLAGS = @EXTRA_CFLAGS@ @DEFS@
+AR = @AR@
+RANLIB = @RANLIB@
+SRC_DIR = @srcdir@/..
+TOP_DIR = @srcdir@/..
+GENERIC_DIR = $(TOP_DIR)/generic
+UNIX_DIR = @srcdir@
+BMAP_DIR = $(TOP_DIR)/bitmaps
+TOOL_DIR = @TCL_SRC_DIR@/tools
#----------------------------------------------------------------
# The information below should be usable as is. The configure
@@ -202,12 +260,15 @@ TOOL_DIR = @TCL_SRC_DIR@/tools
# either.
#----------------------------------------------------------------
+CC = @CC@
-CC = @CC@
-CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${TK_SHLIB_CFLAGS} \
+CC_SWITCHES_NO_STUBS = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
-I${UNIX_DIR} -I${GENERIC_DIR} \
--I${BMAP_DIR} -I${TCL_GENERIC_DIR} ${X11_INCLUDES} ${AC_FLAGS} ${PROTO_FLAGS} \
-${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS}
+-I${BMAP_DIR} -I${TCL_GENERIC_DIR} ${X11_INCLUDES} \
+${AC_FLAGS} ${PROTO_FLAGS} \
+${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} ${NO_DEPRECATED_FLAGS}
+
+CC_SWITCHES = ${CC_SWITCHES_NO_STUBS} ${TCL_STUB_FLAGS}
DEPEND_SWITCHES = ${CFLAGS} -I${UNIX_DIR} -I${GENERIC_DIR} \
-I${BMAP_DIR} \
@@ -217,7 +278,9 @@ ${KEYSYM_FLAGS}
WISH_OBJS = tkAppInit.o
-TKTEST_OBJS = tkTestInit.o tkTest.o tkSquare.o
+TCLTEST_OBJS = ${TCL_BIN_DIR}/tclTest.o ${TCL_BIN_DIR}/tclThreadTest.o \
+ ${TCL_BIN_DIR}/tclUnixTest.o
+TKTEST_OBJS = $(TCLTEST_OBJS) tkTestInit.o tkTest.o tkSquare.o
WIDGOBJS = tkButton.o tkEntry.o tkFrame.o tkListbox.o \
tkMenu.o tkMenubutton.o tkMenuDraw.o tkMessage.o tkScale.o \
@@ -232,19 +295,25 @@ IMAGEOBJS = tkImage.o tkImgBmap.o tkImgGIF.o tkImgPPM.o tkImgPhoto.o
TEXTOBJS = tkText.o tkTextBTree.o tkTextDisp.o tkTextImage.o tkTextIndex.o \
tkTextMark.o tkTextTag.o tkTextWind.o
-UNIXOBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixCursor.o \
- tkUnixDialog.o tkUnixDraw.o \
- tkUnixEmbed.o tkUnixEvent.o tkUnixFocus.o tkUnixFont.o tkUnixInit.o \
- tkUnixMenu.o tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o \
- tkUnixSelect.o tkUnixSend.o tkUnixWm.o tkUnixXId.o
+UNIXOBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixConfig.o \
+ tkUnixCursor.o tkUnixDraw.o tkUnixEmbed.o tkUnixEvent.o \
+ tkUnixFocus.o tkUnixFont.o tkUnixInit.o tkUnixKey.o tkUnixMenu.o \
+ tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \
+ tkUnixSend.o tkUnixWm.o tkUnixXId.o tkStubInit.o tkStubLib.o
+
+STUB_LIB_OBJS = tkStubLib.o tkStubImg.o
OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkClipboard.o tkCmds.o \
- tkColor.o tkConfig.o tkCursor.o tkError.o tkEvent.o \
+ tkColor.o tkConfig.o tkConsole.o tkCursor.o tkError.o tkEvent.o \
tkFocus.o tkFont.o tkGet.o tkGC.o tkGeometry.o tkGrab.o tkGrid.o \
- tkMain.o tkOption.o tkPack.o tkPlace.o \
- tkSelect.o tkUtil.o tkVisual.o tkWindow.o \
+ tkMain.o tkObj.o tkOldConfig.o tkOption.o tkPack.o tkPlace.o \
+ tkSelect.o tkUtil.o tkVisual.o tkWindow.o \
$(UNIXOBJS) $(WIDGOBJS) $(CANVOBJS) $(IMAGEOBJS) $(TEXTOBJS)
+TK_DECLS = \
+ $(GENERIC_DIR)/tk.decls \
+ $(GENERIC_DIR)/tkInt.decls
+
SRCS = \
$(GENERIC_DIR)/tk3d.c $(GENERIC_DIR)/tkArgv.c \
$(GENERIC_DIR)/tkAtom.c $(GENERIC_DIR)/tkBind.c \
@@ -255,12 +324,12 @@ SRCS = \
$(GENERIC_DIR)/tkFocus.c $(GENERIC_DIR)/tkFont.c \
$(GENERIC_DIR)/tkGet.c $(GENERIC_DIR)/tkGC.c \
$(GENERIC_DIR)/tkGeometry.c $(GENERIC_DIR)/tkGrab.c \
- $(GENERIC_DIR)/tkGrid.c \
+ $(GENERIC_DIR)/tkGrid.c $(GENERIC_DIR)/tkConsole.c \
$(GENERIC_DIR)/tkMain.c $(GENERIC_DIR)/tkOption.c \
$(GENERIC_DIR)/tkPack.c $(GENERIC_DIR)/tkPlace.c \
$(GENERIC_DIR)/tkSelect.c $(GENERIC_DIR)/tkUtil.c \
$(GENERIC_DIR)/tkVisual.c $(GENERIC_DIR)/tkWindow.c \
- $(GENERIC_DIR)/tkButton.c \
+ $(GENERIC_DIR)/tkButton.c $(GENERIC_DIR)/tkObj.c \
$(GENERIC_DIR)/tkEntry.c $(GENERIC_DIR)/tkFrame.c \
$(GENERIC_DIR)/tkListbox.c $(GENERIC_DIR)/tkMenu.c \
$(GENERIC_DIR)/tkMenubutton.c $(GENERIC_DIR)/tkMenuDraw.c \
@@ -280,15 +349,19 @@ SRCS = \
$(GENERIC_DIR)/tkTextImage.c \
$(GENERIC_DIR)/tkTextIndex.c $(GENERIC_DIR)/tkTextMark.c \
$(GENERIC_DIR)/tkTextTag.c $(GENERIC_DIR)/tkTextWind.c \
+ $(GENERIC_DIR)/tkOldConfig.c \
$(GENERIC_DIR)/tkSquare.c $(GENERIC_DIR)/tkTest.c \
+ $(GENERIC_DIR)/tkStubInit.c $(GENERIC_DIR)/tkStubLib.c \
$(UNIX_DIR)/tkAppInit.c $(UNIX_DIR)/tkUnix.c \
$(UNIX_DIR)/tkUnix3d.c \
$(UNIX_DIR)/tkUnixButton.c $(UNIX_DIR)/tkUnixColor.c \
+ $(UNIX_DIR)/tkUnixConfig.c \
$(UNIX_DIR)/tkUnixCursor.c \
- $(UNIX_DIR)/tkUnixDialog.c $(UNIX_DIR)/tkUnixDraw.c \
+ $(UNIX_DIR)/tkUnixDraw.c \
$(UNIX_DIR)/tkUnixEmbed.c $(UNIX_DIR)/tkUnixEvent.c \
$(UNIX_DIR)/tkUnixFocus.c \
$(UNIX_DIR)/tkUnixFont.c $(UNIX_DIR)/tkUnixInit.c \
+ $(UNIX_DIR)/tkUnixKey.c \
$(UNIX_DIR)/tkUnixMenu.c $(UNIX_DIR)/tkUnixMenubu.c \
$(UNIX_DIR)/tkUnixScale.c $(UNIX_DIR)/tkUnixScrlbr.c \
$(UNIX_DIR)/tkUnixSelect.c \
@@ -300,48 +373,68 @@ HDRS = bltList.h \
default.h ks_names.h tkPatch.h tk.h tkButton.h tkCanvas.h tkInt.h \
tkPort.h tkScrollbar.h tkText.h
+INSTALL_HDRS = $(GENERIC_DIR)/tk.h \
+ $(GENERIC_DIR)/tkInt.h \
+ $(GENERIC_DIR)/tkDecls.h \
+ $(GENERIC_DIR)/tkIntXlibDecls.h
+
DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget
-all: wish
+all: binaries libraries doc
-# CYGNUS LOCAL
+binaries: ${TK_LIB_FILE} ${STUB_LIB_FILE} wish
-# The shared- and unshared-library cases are separate, so that RANLIB
-# can unconditionally work.
+libraries:
-${TK_SHARED_LIB_FILE}: ${OBJS}
- rm -f @TK_LIB_FILE@
- @MAKE_LIB@
+$(SRC_DIR)/doc/man.macros:
+ chmod +x $(UNIX_DIR)/install-sh
+ $(INSTALL_DATA) @TCL_SRC_DIR@/doc/man.macros $(SRC_DIR)/doc/man.macros
-${TK_UNSHARED_LIB_FILE}: ${OBJS}
- rm -f @TK_LIB_FILE@
+doc: $(SRC_DIR)/doc/man.macros
+
+# The following target is configured by autoconf to generate either
+# a shared library or non-shared library for Tk.
+${TK_LIB_FILE}: ${OBJS}
+ rm -f ${TK_LIB_FILE}
@MAKE_LIB@
$(RANLIB) ${TK_LIB_FILE}
-# END CYGNUS LOCAL
+${STUB_LIB_FILE}: ${STUB_LIB_OBJS}
+ rm -f ${STUB_LIB_FILE}
+ @MAKE_STUB_LIB@
+ $(RANLIB) ${STUB_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
# extensions. used for the Tcl Plugin. -- dl
tkLibObjs:
@echo ${OBJS}
+
# This targets actually build the objects needed for the lib in the above
# case
objs: ${OBJS}
-wish: $(WISH_OBJS) $(TK_LIB_FILE)
- $(CC) @LD_FLAGS@ $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ $(LIBS) \
- $(TK_CC_SEARCH_FLAGS) -o wish
+wish: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @TCL_LIB_FULL_PATH@
+ $(CC) $(LDFLAGS) $(WISH_OBJS) \
+ @TK_BUILD_LIB_SPEC@ \
+ $(WISH_LIBS) $(TK_CC_SEARCH_FLAGS) -o wish
+
+# This rule is executed if the user tried to run tktest without first
+# building tcltest in the Tcl bin directory. Just do it for them.
+${TCL_BIN_DIR}/tcltest:
+ cd ${TCL_BIN_DIR} ; \
+ make tcltest
-tktest: $(TKTEST_OBJS) $(TK_LIB_FILE)
- ${CC} @LD_FLAGS@ $(TKTEST_OBJS) @TK_BUILD_LIB_SPEC@ $(LIBS) \
- $(TK_CC_SEARCH_FLAGS) -o tktest
+tktest: ${TCL_BIN_DIR}/tcltest $(TKTEST_OBJS) $(TK_LIB_FILE) @TCL_LIB_FULL_PATH@
+ ${CC} $(LDFLAGS) $(TKTEST_OBJS) \
+ @TK_BUILD_LIB_SPEC@ \
+ $(WISH_LIBS) $(TK_CC_SEARCH_FLAGS) -o tktest
-xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE)
- ${CC} @LD_FLAGS@ test.o tkTest.o tkSquare.o \
- @TK_BUILD_LIB_SPEC@ $(LIBS) \
- @TK_LD_SEARCH_FLAGS@ -lXt -o xttest
+xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE) @TCL_LIB_FULL_PATH@
+ ${CC} $(LDFLAGS) test.o tkTest.o tkSquare.o \
+ @TK_BUILD_LIB_SPEC@ \
+ $(WISH_LIBS) $(TK_LD_SEARCH_FLAGS) -lXt -o xttest
# Note, in the target below TCL_LIBRARY needs to be set or else
# "make test" won't work in the case where the compilation directory
@@ -350,48 +443,63 @@ xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE)
test: tktest
LD_LIBRARY_PATH=`pwd`:${TCL_BIN_DIR}:${LD_LIBRARY_PATH}; \
export LD_LIBRARY_PATH; \
+ LIBPATH=`pwd`:${TCL_BIN_DIR}:${LIBPATH}; export LIBPATH; \
SHLIB_PATH=`pwd`:${TCL_BIN_DIR}:${SHLIB_PATH}; \
export SHLIB_PATH; \
TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TK_LIBRARY=$(TOP_DIR)/library; export TK_LIBRARY; \
- ( echo cd $(TOP_DIR)/tests\; source all\; exit ) \
- | ./tktest -geometry +0+0
-
+ TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; \
+ ./tktest $(TOP_DIR)/tests/all.tcl -geometry +0+0 $(TCLTESTARGS)
# Useful target to launch a built tktest with the proper path,...
-runtest:
+runtest: tktest
LD_LIBRARY_PATH=`pwd`:${TCL_BIN_DIR}:${LD_LIBRARY_PATH}; \
export LD_LIBRARY_PATH; \
- SHLIB_PATH=`pwd`:${TCL_BIN_DIR}:${SHLIB_PATH}; \
- export SHLIB_PATH; \
+ LIBPATH=`pwd`:${TCL_BIN_DIR}:${LIBPATH}; export LIBPATH; \
+ SHLIB_PATH=`pwd`:${TCL_BIN_DIR}:${SHLIB_PATH}; export SHLIB_PATH; \
TCL_LIBRARY=@TCL_SRC_DIR@/library; export TCL_LIBRARY; \
- TK_LIBRARY=$(TOP_DIR)/library; export TK_LIBRARY; \
+ TK_LIBRARY=@TK_SRC_DIR@/library; export TK_LIBRARY; \
./tktest
-install: install-binaries install-libraries install-demos install-man
+install: all install-binaries install-libraries install-demos install-doc
# 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_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) wish
@for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
do \
if [ ! -d $$i ] ; then \
echo "Making directory $$i"; \
- mkdir $$i; \
+ mkdir -p $$i; \
chmod 755 $$i; \
else true; \
fi; \
done;
- @echo "Installing $(TK_LIB_FILE)"
+ @if test ! -x $(UNIX_DIR)/install-sh; then \
+ chmod +x $(UNIX_DIR)/install-sh; \
+ fi
+ @if test ! -x $(UNIX_DIR)/mkLinks; then \
+ chmod +x $(UNIX_DIR)/mkLinks; \
+ fi
+ @echo "Installing $(TK_LIB_FILE) to $(LIB_INSTALL_DIR)/"
@$(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)
- @echo "Installing wish"
- @$(INSTALL_PROGRAM) wish $(BIN_INSTALL_DIR)/wish
- @echo "Installing tkConfig.sh"
+ @echo "Installing wish as $(BIN_INSTALL_DIR)/wish$(VERSION)"
+ @$(INSTALL_PROGRAM) wish $(BIN_INSTALL_DIR)/wish$(VERSION)
+ @echo "Installing tkConfig.sh to $(LIB_INSTALL_DIR)/"
@$(INSTALL_DATA) tkConfig.sh $(LIB_INSTALL_DIR)/tkConfig.sh
+ @if test "$(TK_BUILD_EXP_FILE)" != ""; then \
+ echo "Installing $(TK_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \
+ $(INSTALL_DATA) $(TK_BUILD_EXP_FILE) \
+ $(LIB_INSTALL_DIR)/$(TK_EXP_FILE); \
+ fi
+ @if test "$(TK_STUB_LIB_FILE)" != "" ; then \
+ echo "Installing $(TK_STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \
+ $(INSTALL_DATA) $(STUB_LIB_FILE) \
+ $(LIB_INSTALL_DIR)/$(TK_STUB_LIB_FILE); \
+ fi
install-libraries:
@for i in $(INSTALL_ROOT)@datadir@ $(INCLUDE_INSTALL_DIR) \
@@ -399,22 +507,29 @@ install-libraries:
do \
if [ ! -d $$i ] ; then \
echo "Making directory $$i"; \
- mkdir $$i; \
+ mkdir -p $$i; \
chmod 755 $$i; \
else true; \
fi; \
done;
- @echo "Installing tk.h"
- @$(INSTALL_DATA) $(GENERIC_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; \
+ @if test ! -x $(UNIX_DIR)/install-sh; then \
+ chmod +x $(UNIX_DIR)/install-sh; \
+ fi
+ @echo "Installing header files";
+ @for i in $(INSTALL_HDRS) ; \
+ do \
+ $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR); \
+ done;
+ @echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
+ @for i in $(SRC_DIR)/library/*.tcl $(GENERIC_DIR)/prolog.ps \
+ $(SRC_DIR)/library/tclIndex $(UNIX_DIR)/tkAppInit.c; \
do \
- echo "Installing $$i"; \
$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
done;
- for i in $(SRC_DIR)/library/images/*; \
+ @echo "Installing library images directory";
+ @for i in $(SRC_DIR)/library/images/*; \
do \
if [ -f $$i ] ; then \
- echo "Installing $$i"; \
$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/images; \
fi; \
done;
@@ -444,15 +559,15 @@ install-demos:
do \
if [ ! -d $$i ] ; then \
echo "Making directory $$i"; \
- mkdir $$i; \
+ mkdir -p $$i; \
chmod 755 $$i; \
else true; \
fi; \
done;
+ @echo "Installing demos to $(SCRIPT_INSTALL_DIR)/demos/";
@for i in $(SRC_DIR)/library/demos/*; \
do \
if [ -f $$i ] ; then \
- echo "Installing $$i"; \
sed -e '3 s|exec wish|exec wish$(VERSION)|' \
$$i > $(SCRIPT_INSTALL_DIR)/demos/`basename $$i`; \
fi; \
@@ -461,51 +576,54 @@ install-demos:
do \
chmod 755 $(SCRIPT_INSTALL_DIR)/demos/$$i; \
done;
+ @echo "Installing demo images";
@for i in $(SRC_DIR)/library/demos/images/*; \
do \
if [ -f $$i ] ; then \
- echo "Installing $$i"; \
$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/images; \
fi; \
done;
-install-man:
- @for i in $(MAN_INSTALL_DIR) $(MAN1_INSTALL_DIR) $(MAN3_INSTALL_DIR) ; \
+install-doc:
+ @for i in $(MAN_INSTALL_DIR) $(MAN1_INSTALL_DIR) $(MAN3_INSTALL_DIR) $(MANN_INSTALL_DIR) ; \
do \
if [ ! -d $$i ] ; then \
echo "Making directory $$i"; \
- mkdir $$i; \
+ mkdir -p $$i; \
chmod 755 $$i; \
else true; \
fi; \
done;
+ @echo "Installing top-level (.1) docs";
@cd $(SRC_DIR)/doc; for i in *.1; \
do \
- echo "Installing doc/$$i"; \
rm -f $(MAN1_INSTALL_DIR)/$$i; \
sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
$$i > $(MAN1_INSTALL_DIR)/$$i; \
chmod 644 $(MAN1_INSTALL_DIR)/$$i; \
done;
- $(UNIX_DIR)/mkLinks $(MAN1_INSTALL_DIR)
+ @echo "Cross-linking top-level (.1) docs";
+ @$(UNIX_DIR)/mkLinks $(MAN1_INSTALL_DIR)
+ @echo "Installing C API (.3) docs";
@cd $(SRC_DIR)/doc; for i in *.3; \
do \
- 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 644 $(MAN3_INSTALL_DIR)/$$i; \
done;
+ @echo "Cross-linking top-level (.3) docs";
+ @$(UNIX_DIR)/mkLinks $(MAN3_INSTALL_DIR)
+ @echo "Installing command (.n) docs";
@cd $(SRC_DIR)/doc; for i in *.n; \
do \
- echo "Installing doc/$$i"; \
- rm -f $(MAN3_INSTALL_DIR)/$$i; \
- name=`echo $$i | sed -e 's/n$$/3/'`; \
+ rm -f $(MANN_INSTALL_DIR)/$$i; \
sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
$$i > $(MAN3_INSTALL_DIR)/$$name; \
chmod 644 $(MAN3_INSTALL_DIR)/$$name; \
done;
- $(UNIX_DIR)/mkLinks $(MAN3_INSTALL_DIR)
+ @echo "Cross-linking command (.n) docs";
+ @$(UNIX_DIR)/mkLinks $(MANN_INSTALL_DIR)
Makefile: $(UNIX_DIR)/Makefile.in config.status
$(SHELL) config.status
@@ -519,7 +637,7 @@ clean:
distclean: clean
rm -f Makefile config.status config.cache config.log tkConfig.sh \
- SUNWtk.* prototype
+ $(PACKAGE).* prototype
depend:
makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
@@ -533,19 +651,19 @@ tkTestInit.o: $(UNIX_DIR)/tkAppInit.c
rm -f tkAppInit.sav; \
mv tkAppInit.o tkAppInit.sav; \
fi;
- $(CC) -c $(CC_SWITCHES) -DTK_TEST $(UNIX_DIR)/tkAppInit.c
+ $(CC) -c $(CC_SWITCHES_NO_STUBS) -DTK_TEST $(UNIX_DIR)/tkAppInit.c
rm -f tkTestInit.o
mv tkAppInit.o tkTestInit.o
@if test -f tkAppInit.sav ; then \
mv tkAppInit.sav tkAppInit.o; \
fi;
+tkAppInit.o: $(UNIX_DIR)/tkAppInit.c
+ $(CC) -c $(CC_SWITCHES_NO_STUBS) $(UNIX_DIR)/tkAppInit.c
+
tk3d.o: $(GENERIC_DIR)/tk3d.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tk3d.c
-tkAppInit.o: $(UNIX_DIR)/tkAppInit.c
- $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkAppInit.c
-
tkArgv.o: $(GENERIC_DIR)/tkArgv.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkArgv.c
@@ -570,6 +688,9 @@ tkColor.o: $(GENERIC_DIR)/tkColor.c
tkConfig.o: $(GENERIC_DIR)/tkConfig.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkConfig.c
+tkConsole.o: $(GENERIC_DIR)/tkConsole.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkConsole.c
+
tkCursor.o: $(GENERIC_DIR)/tkCursor.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkCursor.c
@@ -603,6 +724,12 @@ tkGrid.o: $(GENERIC_DIR)/tkGrid.c
tkMain.o: $(GENERIC_DIR)/tkMain.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkMain.c
+tkObj.o: $(GENERIC_DIR)/tkObj.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkObj.c
+
+tkOldConfig.o: $(GENERIC_DIR)/tkOldConfig.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkOldConfig.c
+
tkOption.o: $(GENERIC_DIR)/tkOption.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkOption.c
@@ -655,7 +782,7 @@ tkScrollbar.o: $(GENERIC_DIR)/tkScrollbar.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkScrollbar.c
tkSquare.o: $(GENERIC_DIR)/tkSquare.c
- $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkSquare.c
+ $(CC) -c $(CC_SWITCHES_NO_STUBS) $(GENERIC_DIR)/tkSquare.c
tkCanvas.o: $(GENERIC_DIR)/tkCanvas.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkCanvas.c
@@ -709,7 +836,7 @@ tkImgPhoto.o: $(GENERIC_DIR)/tkImgPhoto.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c
tkTest.o: $(GENERIC_DIR)/tkTest.c
- $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkTest.c
+ $(CC) -c $(CC_SWITCHES_NO_STUBS) $(GENERIC_DIR)/tkTest.c
tkText.o: $(GENERIC_DIR)/tkText.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkText.c
@@ -735,6 +862,18 @@ tkTextTag.o: $(GENERIC_DIR)/tkTextTag.c
tkTextWind.o: $(GENERIC_DIR)/tkTextWind.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkTextWind.c
+tkStubInit.o: $(GENERIC_DIR)/tkStubInit.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubInit.c
+
+# Stub library binaries, these must be compiled for use in a shared library
+# even though they will be placed in a static archive
+
+tkStubLib.o: $(GENERIC_DIR)/tkStubLib.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubLib.c
+
+tkStubImg.o: $(GENERIC_DIR)/tkStubImg.c
+ $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkStubImg.c
+
tkUnix.o: $(UNIX_DIR)/tkUnix.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnix.c
@@ -747,12 +886,12 @@ tkUnixButton.o: $(UNIX_DIR)/tkUnixButton.c
tkUnixColor.o: $(UNIX_DIR)/tkUnixColor.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixColor.c
+tkUnixConfig.o: $(UNIX_DIR)/tkUnixConfig.c
+ $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixConfig.c
+
tkUnixCursor.o: $(UNIX_DIR)/tkUnixCursor.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixCursor.c
-tkUnixDialog.o: $(UNIX_DIR)/tkUnixDialog.c
- $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixDialog.c
-
tkUnixDraw.o: $(UNIX_DIR)/tkUnixDraw.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixDraw.c
@@ -772,6 +911,9 @@ tkUnixInit.o: $(UNIX_DIR)/tkUnixInit.c $(GENERIC_DIR)/tkInitScript.h tkConfig.sh
$(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
$(UNIX_DIR)/tkUnixInit.c
+tkUnixKey.o: $(UNIX_DIR)/tkUnixKey.c
+ $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixKey.c
+
tkUnixMenu.o: $(UNIX_DIR)/tkUnixMenu.c
$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixMenu.c
@@ -814,6 +956,46 @@ checkuchar:
checkexports: $(TK_LIB_FILE)
-nm -p $(TK_LIB_FILE) | awk '$$2 ~ /[TDB]/ { print $$3 }' | sort -n | grep -v '^[Tt]k'
+# Target to regenerate header files and stub files from the *.decls tables.
+#
+
+genstubs:
+ $(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(GENERIC_DIR) \
+ $(GENERIC_DIR)/tk.decls $(GENERIC_DIR)/tkInt.decls
+
+#
+# Target to check that all exported functions have an entry in the stubs
+# tables.
+#
+
+checkstubs:
+ -@for i in `nm -p $(TK_LIB_FILE) | awk '$$2 ~ /T/ { print $$3 }' \
+ | sort -n`; do \
+ match=0; \
+ for j in $(TK_DECLS); do \
+ if [ `grep -c $$i $$j` -gt 0 ]; then \
+ match=1; \
+ fi; \
+ done; \
+ if [ $$match -eq 0 ]; then echo $$i; fi \
+ done
+
+
+#
+# Target to create a Tk RPM for Linux. Requires that you be on a Linux
+# system.
+#
+
+rpm: all /bin/rpm
+ rm -f THIS.TCL.SPEC
+ echo "%define _builddir `pwd`" > THIS.TK.SPEC
+ echo "%define _rpmdir `pwd`/RPMS" >> THIS.TK.SPEC
+ cat tk.spec >> THIS.TK.SPEC
+ mkdir -p RPMS/i386
+ rpm -bb THIS.TK.SPEC
+ mv RPMS/i386/*.rpm .
+ rm -rf RPMS THIS.TK.SPEC
+
#
# Target to create a proper Tk distribution from information in the
# master source directory. DISTDIR must be defined to indicate where
@@ -830,18 +1012,18 @@ $(UNIX_DIR)/configure:
dist: $(UNIX_DIR)/configure
rm -rf $(DISTDIR)
- mkdir $(DISTDIR)
+ mkdir -p $(DISTDIR)
mkdir $(DISTDIR)/unix
cp -p $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix
cp $(TOP_DIR)/license.terms $(UNIX_DIR)/Makefile.in $(DISTDIR)/unix
chmod 664 $(DISTDIR)/unix/Makefile.in
cp $(UNIX_DIR)/configure $(UNIX_DIR)/configure.in \
+ $(UNIX_DIR)/aclocal.m4 \
$(UNIX_DIR)/tkConfig.sh.in $(TCLDIR)/unix/install-sh \
- $(UNIX_DIR)/porting.notes $(UNIX_DIR)/porting.old \
$(UNIX_DIR)/README $(DISTDIR)/unix
chmod 775 $(DISTDIR)/unix/configure $(DISTDIR)/unix/configure.in
chmod +x $(DISTDIR)/unix/install-sh
- tclsh $(TCLDIR)/unix/mkLinks.tcl $(TOP_DIR)/doc/*.[13n] \
+ $(TCL_EXE) $(TCLDIR)/unix/mkLinks.tcl $(TOP_DIR)/doc/*.[13n] \
> $(DISTDIR)/unix/mkLinks
chmod +x $(DISTDIR)/unix/mkLinks
mkdir $(DISTDIR)/bitmaps
@@ -852,12 +1034,20 @@ dist: $(UNIX_DIR)/configure
fi; \
done;)
mkdir $(DISTDIR)/generic
- cp -p $(GENERIC_DIR)/*.c $(GENERIC_DIR)/*.h $(DISTDIR)/generic
+ cp -p $(GENERIC_DIR)/*.c $(GENERIC_DIR)/*.h $(GENERIC_DIR)/prolog.ps \
+ $(DISTDIR)/generic
+ cp -p $(GENERIC_DIR)/*.decls $(DISTDIR)/generic
cp -p $(GENERIC_DIR)/README $(DISTDIR)/generic
- cp -p $(TOP_DIR)/changes $(TOP_DIR)/README $(TOP_DIR)/license.terms \
- $(DISTDIR)
+ cp -p $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog $(TOP_DIR)/README \
+ $(TOP_DIR)/license.terms $(DISTDIR)
rm -f $(DISTDIR)/generic/blt*.[ch]
mkdir $(DISTDIR)/win
+ cp $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win
+ cp $(TOP_DIR)/win/configure.in \
+ $(TOP_DIR)/win/configure \
+ $(TOP_DIR)/win/tkConfig.sh.in \
+ $(TOP_DIR)/win/aclocal.m4 \
+ $(DISTDIR)/win
cp -p $(TOP_DIR)/win/*.c $(TOP_DIR)/win/*.h $(DISTDIR)/win
cp -p $(TOP_DIR)/win/*.bat $(DISTDIR)/win
cp -p $(TOP_DIR)/win/makefile.* $(DISTDIR)/win
@@ -868,10 +1058,7 @@ dist: $(UNIX_DIR)/configure
$(TOP_DIR)/win/rc/*.ico $(TOP_DIR)/win/rc/*.bmp \
$(DISTDIR)/win/rc
mkdir $(DISTDIR)/mac
- sccs edit -s $(TOP_DIR)/mac/tkMacProjects.sea.hqx
- cp -p tkMacProjects.sea.hqx $(DISTDIR)/mac
- sccs unedit $(TOP_DIR)/mac/tkMacProjects.sea.hqx
- rm -f tkMacProjects.sea.hqx
+ cp -p $(TOP_DIR)/mac/tkMacProjects.sea.hqx $(DISTDIR)/mac
cp -p $(TOP_DIR)/mac/*.c $(TOP_DIR)/mac/*.h $(TOP_DIR)/mac/*.r \
$(DISTDIR)/mac
cp -p $(TOP_DIR)/mac/README $(DISTDIR)/mac
@@ -892,7 +1079,7 @@ dist: $(UNIX_DIR)/configure
cp -p $(TOP_DIR)/license.terms $(DISTDIR)/xlib/X11
mkdir $(DISTDIR)/library
cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \
- $(TOP_DIR)/library/tclIndex $(TOP_DIR)/library/prolog.ps \
+ $(TOP_DIR)/library/tclIndex \
$(DISTDIR)/library
mkdir $(DISTDIR)/library/images
@(cd $(TOP_DIR); for i in library/images/* ; do \
@@ -923,10 +1110,8 @@ dist: $(UNIX_DIR)/configure
$(TCLDIR)/doc/man.macros $(DISTDIR)/doc
mkdir $(DISTDIR)/tests
cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/tests/*.test \
- $(TOP_DIR)/tests/visual $(TOP_DIR)/tests/*.tcl \
- $(TOP_DIR)/tests/README $(TOP_DIR)/tests/all \
- $(TOP_DIR)/tests/defs $(TOP_DIR)/tests/option.file* \
- $(DISTDIR)/tests
+ $(TOP_DIR)/tests/*.tcl $(TOP_DIR)/tests/README \
+ $(TOP_DIR)/tests/option.file* $(DISTDIR)/tests
#
# The following target can only be used for non-patch releases. Use
@@ -939,7 +1124,7 @@ alldist: dist
$(DISTROOT)/$(ZIPNAME)
cd $(DISTROOT); tar cf $(DISTNAME).tar $(DISTNAME); \
gzip -9 -c $(DISTNAME).tar > $(DISTNAME).tar.gz; \
- compress $(DISTNAME).tar; zip -r8 $(ZIPNAME) $(DISTNAME)
+ compress $(DISTNAME).tar; zip -qr8 $(ZIPNAME) $(DISTNAME)
#
# The target below is similar to "alldist" except it works for patch
@@ -970,11 +1155,11 @@ allpatch: dist
macdist: dist
rm -f $(DISTDIR)/mac/tkMacProjects.sea.hqx
- tclsh $(TOOL_DIR)/man2html.tcl $(DISTDIR)/tmp ../.. tk$(VERSION)
+ $(TCL_EXE) $(TOOL_DIR)/man2html.tcl $(DISTDIR)/tmp ../.. tk$(VERSION)
mv $(DISTDIR)/tmp/tk$(VERSION) $(DISTDIR)/html
rm -rf $(DISTDIR)/doc
rm -rf $(DISTDIR)/tmp
- tclsh $(TOOL_DIR)/cvtEOL.tcl $(DISTDIR)
+ $(TCL_EXE) $(TOOL_DIR)/cvtEOL.tcl $(DISTDIR)
#
# Targets to build Solaris package of the distribution for the current
@@ -1022,7 +1207,7 @@ package-config:
package-common:
cd $(DISTDIR)/unix/`arch`;\
$(MAKE); \
- $(MAKE) install-libraries install-man \
+ $(MAKE) install-libraries install-doc \
prefix=$(DISTDIR)/SUNWtcl/$(TCLVERSION) \
exec_prefix=$(DISTDIR)/SUNWtcl/$(TCLVERSION)/`arch`
mkdir -p $(DISTDIR)/SUNWtcl/$(TCLVERSION)/bin
@@ -1052,10 +1237,11 @@ package-generate:
$(DISTDIR)/SUNWtcl/$(TCLVERSION)/lib=lib \
$(DISTDIR)/SUNWtcl/$(TCLVERSION)/man=man \
$(DISTDIR)/SUNWtcl/$(TCLVERSION)/`arch`=`arch` \
- | tclsh $(TCLDIR)/unix/mkProto.tcl $(TCLVERSION) \
+ | $(TCL_EXE) $(TCLDIR)/unix/mkProto.tcl $(TCLVERSION) \
$(UNIX_DIR) > prototype
pkgmk -o -d . -f prototype -a `arch`
pkgtrans -s . $(PACKAGE).`arch` $(PACKAGE)
rm -rf $(PACKAGE)
# DO NOT DELETE THIS LINE -- make depend depends on it.
+
diff --git a/tk/unix/README b/tk/unix/README
index 2ee3d41173e..994c1bc54ed 100644
--- a/tk/unix/README
+++ b/tk/unix/README
@@ -1,7 +1,17 @@
+Tk UNIX README
+--------------
+
This is the directory where you configure, compile, test, and install
UNIX versions of Tk. This directory also contains source files for Tk
that are specific to UNIX.
+The information in this file is maintained at:
+ http://dev.scriptics.com/doc/howto/compile.html
+
+For information on platforms where Tcl/Tk is known to compile, along
+with any porting notes for getting it to work on those platforms, see:
+ http://dev.scriptics.com/software/tcltk/platforms.html
+
The rest of this file contains instructions on how to do this. The
release should compile and run either "out of the box" or with trivial
changes on any UNIX-like system that approximates POSIX, BSD, or System
@@ -15,9 +25,9 @@ RCS: @(#) $Id$
How To Compile And Install Tk:
------------------------------
-(a) Make sure that the Tcl 8.0 release is present in the directory
- ../../tcl8.0 (or else use the "--with-tcl" switch described below).
- This release of Tk will only work with Tcl 8.0. Also, be sure that
+(a) Make sure that the Tcl 8.3 release is present in the directory
+ ../../tcl8.3 (or else use the "--with-tcl" switch described below).
+ This release of Tk will only work with Tcl 8.3. Also, be sure that
you have configured Tcl before you configure Tk.
(b) Check for patches as described in ../README.
@@ -38,6 +48,8 @@ How To Compile And Install Tk:
itself to use gcc if it is available on your
system. Note: it is not safe to modify the
Makefile to use gcc after configure is run.
+ --enable-threads Tk on Unix currently does not support
+ threaded builds.
--with-tcl=DIR Specifies the directory containing the Tcl
binaries and Tcl's platform-dependent
configuration information. By default
@@ -45,19 +57,23 @@ How To Compile And Install Tk:
location given by (a) above.
--enable-shared If this switch is specified, Tk will compile
itself as a shared library if it can figure
- out how to do that on this platform.
+ out how to do that on this platform. This
+ is the default on platforms where we know
+ how to build shared libraries.
+ --disable-shared If this switch is specified, Tk will compile
+ itself as a static library.
Note: be sure to use only absolute path names (those starting with "/")
in the --prefix and --exec_prefix options.
-(e) Type "make". This will create a library archive called "libtk.a"
- or "libtk.so" and an interpreter application called "wish" that
- allows you to type Tcl commands interactively or execute script files.
+(e) Type "make". This will create a library archive called
+ "libtk<version>.a" or "libtk<version>.so" and an interpreter
+ application called "wish" that allows you to type Tcl commands
+ interactively or execute script files.
(f) If the make fails then you'll have to personalize the Makefile
for your site or possibly modify the distribution in other ways.
- First check the file "porting.notes" to see if there are hints
- for compiling on your system. Then look at the porting Web page
- described later in this file. If you need to modify Makefile,
+ First check the porting Web page above to see if there are hints
+ for compiling on your system. If you need to modify Makefile,
there are comments at the beginning of it that describe the things
you might want to change and how to change them.
@@ -78,23 +94,15 @@ How To Compile And Install Tk:
TCL_LIBRARY environment variable as well (see the Tcl README file
for information on this). Note that installed versions of wish,
libtk.a, libtk.so, and the Tk library have a version number in their
- names, such as "wish8.0" or "libtk8.0.so"; to use the installed
+ names, such as "wish8.3" or "libtk8.3.so"; to use the installed
versions, either specify the version number or create a symbolic
- link (e.g. from "wish" to "wish8.0").
-
-If you have trouble compiling Tk, read through the file "porting.notes".
-It contains information that people have provided about changes they had
-to make to compile Tcl in various environments. Or, check out the
-following Web URL:
- http://www.sunlabs.com/cgi-bin/tcl/info.8.0
-This is an on-line database of porting information. We make no guarantees
-that this information is accurate, complete, or up-to-date, but you may
-find it useful. If you get Tk running on a new configuration and had to
-make non-trivial changes to do it, we'd be happy to receive new information
-to add to "porting.notes". You can also make a new entry into the
-on-line Web database. We're also interested in hearing how to change the
-configuration setup so that Tcl compiles on additional platforms "out of
-the box".
+ link (e.g. from "wish" to "wish8.3").
+
+If you have trouble compiling Tk, see the URL noted above about working
+platforms. It contains information that people have provided about changes
+they had to make to compile Tk in various environments. We're also
+interested in hearing how to change the configuration setup so that Tk
+compiles on additional platforms "out of the box".
Test suite
----------
@@ -123,3 +131,5 @@ Postscript generation, etc. These tests all have to be run manually and
the results have to be verified visually. To run the tests, cd to the
"tests" directory and run the script "visual". It will present a main
window with a bunch of menus, which you can use to select various tests.
+
+
diff --git a/tk/unix/aclocal.m4 b/tk/unix/aclocal.m4
new file mode 100644
index 00000000000..005783c4aae
--- /dev/null
+++ b/tk/unix/aclocal.m4
@@ -0,0 +1,2 @@
+builtin(include,tcl.m4)
+builtin(include,../cygtcl.m4)
diff --git a/tk/unix/configure b/tk/unix/configure
index 2b0b092e086..aa9968aab13 100755
--- a/tk/unix/configure
+++ b/tk/unix/configure
@@ -12,13 +12,21 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
- --enable-gcc allow use of gcc if available"
+ --enable-threads build with threads"
ac_help="$ac_help
- --with-tcl=DIR use Tcl 8.0 binaries from DIR"
+ --with-tcl directory containing tcl configuration (tclConfig.sh)"
+ac_help="$ac_help
+ --enable-64bit enable 64bit support (where applicable)"
+ac_help="$ac_help
+ --enable-64bit-vis enable 64bit Sparc VIS support"
+ac_help="$ac_help
+ --disable-load disallow dynamic loading and "load" command"
+ac_help="$ac_help
+ --enable-symbols build with debugging symbols [--disable-symbols]"
ac_help="$ac_help
--with-x use the X Window System"
ac_help="$ac_help
- --enable-shared build libtk as a shared library"
+ --enable-shared build and link with shared libraries [--enable-shared]"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@@ -36,6 +44,7 @@ program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
+sitefile=
srcdir=
target=NONE
verbose=
@@ -150,6 +159,7 @@ Configuration:
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
+ --site-file=FILE use FILE as the site file
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
@@ -320,6 +330,11 @@ EOF
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
+ -site-file | --site-file | --site-fil | --site-fi | --site-f)
+ ac_prev=sitefile ;;
+ -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
+ sitefile="$ac_optarg" ;;
+
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -485,12 +500,16 @@ fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+if test -z "$sitefile"; then
+ if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
fi
+else
+ CONFIG_SITE="$sitefile"
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
@@ -529,409 +548,12 @@ else
fi
-# SCCS: @(#) configure.in 1.90 97/11/20 12:45:45
-
-# CYGNUS LOCAL tromey - find config.guess/config.sub in our tree
-ac_aux_dir=
-for ac_dir in $srcdir/../.. $srcdir/$srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir/../.. $srcdir/$srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:583: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:604: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:622: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:647: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:677: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:728: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:760: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 771 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:802: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:807: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:835: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:878: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
+# RCS: @(#) $Id$
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-# END CYGNUS LOCAL
-
-TK_VERSION=8.0
+TK_VERSION=8.3
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=0
-TK_PATCH_LEVEL=".4"
+TK_MINOR_VERSION=3
+TK_PATCH_LEVEL=".2"
VERSION=${TK_VERSION}
if test "${prefix}" = "NONE"; then
@@ -940,12 +562,42 @@ fi
if test "${exec_prefix}" = "NONE"; then
exec_prefix=$prefix
fi
-TK_SRC_DIR=`cd $srcdir/..; pwd`
+# Make sure srcdir is fully qualified!
+srcdir=`cd $srcdir ; pwd`
+
+ val="`cd $srcdir/..; pwd`"
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable TK_SRC_DIR" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ TK_SRC_DIR=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ TK_SRC_DIR="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ TK_SRC_DIR=$val
+ ;;
+ esac
+
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:949: checking for $ac_word" >&5
+echo "configure:601: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -972,19 +624,10 @@ else
echo "$ac_t""no" 1>&6
fi
-# Check whether --enable-gcc or --disable-gcc was given.
-if test "${enable_gcc+set}" = set; then
- enableval="$enable_gcc"
- tk_ok=$enableval
-else
- tkl_ok=no
-fi
-
-if test "$tk_ok" = "yes"; then
- # Extract the first word of "gcc", so it can be a program name with args.
+# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:988: checking for $ac_word" >&5
+echo "configure:631: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1014,7 +657,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1018: checking for $ac_word" >&5
+echo "configure:661: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1065,7 +708,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1069: checking for $ac_word" >&5
+echo "configure:712: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1097,7 +740,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1101: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:744: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1108,12 +751,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 1112 "configure"
+#line 755 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:1117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1139,12 +782,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1143: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:786: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1148: checking whether we are using GNU C" >&5
+echo "configure:791: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1153,7 +796,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1172,7 +815,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1176: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:819: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1203,12 +846,9 @@ else
fi
fi
-else
- CC=${CC-cc}
-fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1212: checking how to run the C preprocessor" >&5
+echo "configure:852: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1223,13 +863,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1227 "configure"
+#line 867 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1233: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1240,13 +880,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1244 "configure"
+#line 884 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1257,13 +897,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1261 "configure"
+#line 901 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1267: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:907: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1291,17 +931,17 @@ for ac_hdr in unistd.h limits.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1295: checking for $ac_hdr" >&5
+echo "configure:935: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1300 "configure"
+#line 940 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1305: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1328,73 +968,1612 @@ fi
done
-# set the warning flags depending on whether or not we are using gcc
-if test "${GCC}" = "yes" ; then
- # leave -Wimplicit-int out, the X libs generate so many of these warnings
- # that they obscure everything else.
+#------------------------------------------------------------------------
+# Threads support
+#------------------------------------------------------------------------
+
- CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
+ echo $ac_n "checking for building with threads""... $ac_c" 1>&6
+echo "configure:978: checking for building with threads" >&5
+ # Check whether --enable-threads or --disable-threads was given.
+if test "${enable_threads+set}" = set; then
+ enableval="$enable_threads"
+ tcl_ok=$enableval
else
- CFLAGS_WARNING=""
+ tcl_ok=no
+fi
+
+
+ if test "$tcl_ok" = "yes"; then
+ echo "$ac_t""yes" 1>&6
+ TCL_THREADS=1
+ cat >> confdefs.h <<\EOF
+#define TCL_THREADS 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _THREAD_SAFE 1
+EOF
+
+ echo $ac_n "checking for pthread_mutex_init in -lpthread""... $ac_c" 1>&6
+echo "configure:1004: checking for pthread_mutex_init in -lpthread" >&5
+ac_lib_var=`echo pthread'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lpthread $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1012 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init();
+
+int main() {
+pthread_mutex_init()
+; return 0; }
+EOF
+if { (eval echo configure:1023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ tcl_ok=yes
+else
+ echo "$ac_t""no" 1>&6
+tcl_ok=no
+fi
+
+ if test "$tcl_ok" = "no"; then
+ # Check a little harder for __pthread_mutex_init in the same
+ # library, as some systems hide it there until pthread.h is
+ # defined. We could alternatively do an AC_TRY_COMPILE with
+ # pthread.h, but that will work with libpthread really doesn't
+ # exist, like AIX 4.2. [Bug: 4359]
+ echo $ac_n "checking for __pthread_mutex_init in -lpthread""... $ac_c" 1>&6
+echo "configure:1051: checking for __pthread_mutex_init in -lpthread" >&5
+ac_lib_var=`echo pthread'_'__pthread_mutex_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lpthread $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1059 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char __pthread_mutex_init();
+
+int main() {
+__pthread_mutex_init()
+; return 0; }
+EOF
+if { (eval echo configure:1070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ tcl_ok=yes
+else
+ echo "$ac_t""no" 1>&6
+tcl_ok=no
+fi
+
+ fi
+
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthread"
+ else
+ echo $ac_n "checking for pthread_mutex_init in -lpthreads""... $ac_c" 1>&6
+echo "configure:1098: checking for pthread_mutex_init in -lpthreads" >&5
+ac_lib_var=`echo pthreads'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lpthreads $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1106 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init();
+
+int main() {
+pthread_mutex_init()
+; return 0; }
+EOF
+if { (eval echo configure:1117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ tcl_ok=yes
+else
+ echo "$ac_t""no" 1>&6
+tcl_ok=no
+fi
+
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthreads"
+ else
+ echo $ac_n "checking for pthread_mutex_init in -lc""... $ac_c" 1>&6
+echo "configure:1143: checking for pthread_mutex_init in -lc" >&5
+ac_lib_var=`echo c'_'pthread_mutex_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lc $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1151 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_mutex_init();
+
+int main() {
+pthread_mutex_init()
+; return 0; }
+EOF
+if { (eval echo configure:1162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ tcl_ok=yes
+else
+ echo "$ac_t""no" 1>&6
+tcl_ok=no
+fi
+
+ if test "$tcl_ok" = "no"; then
+ TCL_THREADS=0
+ echo "configure: warning: "Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..."" 1>&2
+ fi
+ fi
+ fi
+
+ # Does the pthread-implementation provide
+ # 'pthread_attr_setstacksize' ?
+
+ for ac_func in pthread_attr_setstacksize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1196: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1201 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ else
+ TCL_THREADS=0
+ echo "$ac_t""no (default)" 1>&6
+ fi
+
+
+#------------------------------------------------------------------------------
+# If we're using GCC, see if the compiler understands -pipe. If so, use it.
+# It makes compiling go faster. (This is only a performance feature.)
+#------------------------------------------------------------------------------
+
+if test -z "$no_pipe"; then
+if test -n "$GCC"; then
+ echo $ac_n "checking if the compiler understands -pipe""... $ac_c" 1>&6
+echo "configure:1262: checking if the compiler understands -pipe" >&5
+ OLDCC="$CC"
+ CC="$CC -pipe"
+ cat > conftest.$ac_ext <<EOF
+#line 1266 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CC="$OLDCC"
+ echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+fi
fi
#--------------------------------------------------------------------
-# See if there was a command-line option for where Tcl is; if
-# not, assume that its top-level directory is a sibling of ours.
+# Find and load the tclConfig.sh file
#--------------------------------------------------------------------
-# Check whether --with-tcl or --without-tcl was given.
+
+ #
+ # Ok, lets find the tcl configuration
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-tcl
+ #
+
+ if test x"${no_tcl}" = x ; then
+ # we reset no_tcl in case something fails here
+ no_tcl=true
+ # Check whether --with-tcl or --without-tcl was given.
if test "${with_tcl+set}" = set; then
withval="$with_tcl"
- TCL_BIN_DIR=$withval
+ with_tclconfig=${withval}
+fi
+
+ echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6
+echo "configure:1308: checking for Tcl configuration" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
else
- TCL_BIN_DIR=`cd ../../tcl/unix; pwd`
+
+
+ # First check to see if --with-tclconfig was specified.
+ if test x"${with_tclconfig}" != x ; then
+ if test -f "${with_tclconfig}/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
+ else
+ { echo "configure: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" 1>&2; exit 1; }
+ fi
+ fi
+
+ # then check for a private Tcl installation
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in \
+ ../tcl \
+ `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \
+ ../../tcl \
+ `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \
+ ../../../tcl \
+ `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do
+ if test -f "$i/unix/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ if test -f "$i/win/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/win; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few common install locations
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` ; do
+ if test -f "$i/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few other private locations
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in \
+ ${srcdir}/../tcl \
+ `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do
+ if test -f "$i/unix/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ if test -f "$i/win/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/win; pwd)`
+ break
+ fi
+ done
+ fi
+
fi
-if test -z "$TCL_BIN_DIR"; then
- { echo "configure: error: couldn't find Tcl build directory in ../../tcl/unix" 1>&2; exit 1; }
+
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ TCL_BIN_DIR="# no Tcl configs found"
+ { echo "configure: error: Can't find Tcl configuration definitions" 1>&2; exit 1; }
+ exit 0
+ else
+ no_tcl=
+ TCL_BIN_DIR=${ac_cv_c_tclconfig}
+ echo "$ac_t""found $TCL_BIN_DIR/tclConfig.sh" 1>&6
+ fi
+ fi
+
+
+ echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6
+echo "configure:1386: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
+
+ if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
+ echo "$ac_t""loading" 1>&6
+ . $TCL_BIN_DIR/tclConfig.sh
+ else
+ echo "$ac_t""file not found" 1>&6
+ fi
+
+ #
+ # The eval is required to do the TCL_DBGX substitution in the
+ # TCL_LIB_FILE variable
+ #
+
+ eval TCL_LIB_FILE=${TCL_LIB_FILE}
+ eval TCL_LIB_FLAG=${TCL_LIB_FLAG}
+
+
+
+
+
+
+#--------------------------------------------------------------------
+# Recompute the necessary flags to run the compiler
+#--------------------------------------------------------------------
+
+
+
+ # Step 0.a: Enable 64 bit support?
+
+ echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6
+echo "configure:1417: checking if 64bit support is requested" >&5
+ # Check whether --enable-64bit or --disable-64bit was given.
+if test "${enable_64bit+set}" = set; then
+ enableval="$enable_64bit"
+ :
+else
+ enableval="no"
fi
-if test ! -d $TCL_BIN_DIR; then
- { echo "configure: error: Tcl directory $TCL_BIN_DIR doesn't exist" 1>&2; exit 1; }
+
+
+ if test "$enableval" = "yes"; then
+ do64bit=yes
+ else
+ do64bit=no
+ fi
+ echo "$ac_t""$do64bit" 1>&6
+
+ # Step 0.b: Enable Solaris 64 bit VIS support?
+
+ echo $ac_n "checking if 64bit Sparc VIS support is requested""... $ac_c" 1>&6
+echo "configure:1437: checking if 64bit Sparc VIS support is requested" >&5
+ # Check whether --enable-64bit-vis or --disable-64bit-vis was given.
+if test "${enable_64bit_vis+set}" = set; then
+ enableval="$enable_64bit_vis"
+ :
+else
+ enableval="no"
fi
-if test ! -f $TCL_BIN_DIR/Makefile; then
- { echo "configure: error: There's no Makefile in $TCL_BIN_DIR; perhaps you didn't specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?" 1>&2; exit 1; }
+
+
+ if test "$enableval" = "yes"; then
+ # Force 64bit on with VIS
+ do64bit=yes
+ do64bitVIS=yes
+ else
+ do64bitVIS=no
+ fi
+ echo "$ac_t""$do64bitVIS" 1>&6
+
+ # Step 1: set the variable "system" to hold the name and version number
+ # for the system. This can usually be done via the "uname" command, but
+ # there are a few systems, like Next, where this doesn't work.
+
+ echo $ac_n "checking system version (for dynamic loading)""... $ac_c" 1>&6
+echo "configure:1461: checking system version (for dynamic loading)" >&5
+ if test -f /usr/lib/NextStep/software_version; then
+ system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+ else
+ system=`uname -s`-`uname -r`
+ if test "$?" -ne 0 ; then
+ echo "$ac_t""unknown (can't find uname command)" 1>&6
+ system=unknown
+ else
+ # Special check for weird MP-RAS system (uname returns weird
+ # results, and the version is kept in special file).
+
+ if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+ system=MP-RAS-`awk '{print }' /etc/.relid'`
+ fi
+ if test "`uname -s`" = "AIX" ; then
+ system=AIX-`uname -v`.`uname -r`
+ fi
+ echo "$ac_t""$system" 1>&6
+ fi
+ fi
+
+ echo $ac_n "checking if gcc is being used""... $ac_c" 1>&6
+echo "configure:1484: checking if gcc is being used" >&5
+ if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
+ using_gcc="yes"
+ else
+ using_gcc="no"
+ fi
+
+ echo "$ac_t""$using_gcc ($CC)" 1>&6
+
+ # Step 2: check for existence of -ldl library. This is needed because
+ # Linux can use either -ldl or -ldld for dynamic loading.
+
+ echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:1497: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1505 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:1516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
-#--------------------------------------------------------------------
-# Read in configuration information generated by Tcl for shared
-# libraries, and arrange for it to be substituted into our
-# Makefile.
-#--------------------------------------------------------------------
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ have_dl=yes
+else
+ echo "$ac_t""no" 1>&6
+have_dl=no
+fi
+
+
+ # Step 3: set configuration options based on system name and version.
+
+ do64bit_ok=no
+ fullSrcDir=`cd $srcdir; pwd`
+ EXTRA_CFLAGS=""
+ TCL_EXPORT_FILE_SUFFIX=""
+ UNSHARED_LIB_SUFFIX=""
+ TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
+ ECHO_VERSION='`echo ${VERSION}`'
+ TCL_LIB_VERSIONS_OK=ok
+ CFLAGS_DEBUG=-g
+ CFLAGS_OPTIMIZE=-O
+ if test "$using_gcc" = "yes" ; then
+ CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
+ else
+ CFLAGS_WARNING=""
+ fi
+ TCL_NEEDS_EXP_FILE=0
+ TCL_BUILD_EXP_FILE=""
+ TCL_EXP_FILE=""
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1561: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_AR="ar"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+ echo "$ac_t""$AR" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ STLIB_LD='${AR} cr'
+ case $system in
+ AIX-4.[2-9])
+ if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then
+ # AIX requires the _r compiler when gcc isn't being used
+ if test "${CC}" != "cc_r" ; then
+ CC=${CC}_r
+ fi
+ echo "$ac_t""Using $CC for compiling with threads" 1>&6
+ fi
+ SHLIB_CFLAGS=""
+ SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ TCL_NEEDS_EXP_FILE=1
+ TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
+ ;;
+ AIX-*)
+ if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then
+ # AIX requires the _r compiler when gcc isn't being used
+ if test "${CC}" != "cc_r" ; then
+ CC=${CC}_r
+ fi
+ echo "$ac_t""Using $CC for compiling with threads" 1>&6
+ fi
+ SHLIB_CFLAGS=""
+ SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ LIBOBJS="$LIBOBJS tclLoadAix.o"
+ DL_LIBS="-lld"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ TCL_NEEDS_EXP_FILE=1
+ TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
+ ;;
+ BSD/OS-2.1*|BSD/OS-3*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="shlicc -r"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ BSD/OS-4.*)
+ SHLIB_CFLAGS="-export-dynamic -fPIC"
+ SHLIB_LD="cc -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="-export-dynamic"
+ LD_SEARCH_FLAGS=""
+ ;;
+ dgux*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*)
+ SHLIB_SUFFIX=".sl"
+ echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "configure:1661: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldld $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1669 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
+EOF
+if { (eval echo configure:1680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ tcl_ok=yes
+else
+ echo "$ac_t""no" 1>&6
+tcl_ok=no
+fi
+
+ if test "$tcl_ok" = yes; then
+ SHLIB_CFLAGS="+z"
+ SHLIB_LD="ld -b"
+ SHLIB_LD_LIBS=""
+ DL_OBJS="tclLoadShl.o"
+ DL_LIBS="-ldld"
+ LDFLAGS="-Wl,-E"
+ LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
+ fi
+ ;;
+ IRIX-4.*)
+ SHLIB_CFLAGS="-G 0"
+ SHLIB_SUFFIX=".a"
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ SHLIB_LD_LIBS='${LIBS}'
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS="-Wl,-D,08000000"
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
+ ;;
+ IRIX-5.*|IRIX-6.*|IRIX64-6.5*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -n32 -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ if test "$using_gcc" = "yes" ; then
+ EXTRA_CFLAGS="-mabi=n32"
+ LDFLAGS="-mabi=n32"
+ else
+ case $system in
+ IRIX-6.3)
+ # Use to build 6.2 compatible binaries on 6.3.
+ EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS"
+ ;;
+ *)
+ EXTRA_CFLAGS="-n32"
+ ;;
+ esac
+ LDFLAGS="-n32"
+ fi
+ ;;
+ IRIX64-6.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -32 -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ ;;
+ Linux*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
+ # when you inline the string and math operations. Turn this off to
+ # get rid of the warnings.
+
+ CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+
+ if test "$have_dl" = yes; then
+ SHLIB_LD="${CC} -shared"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="-rdynamic"
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ else
+ ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for dld.h""... $ac_c" 1>&6
+echo "configure:1776: checking for dld.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1781 "configure"
+#include "confdefs.h"
+#include <dld.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1786: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+
+ SHLIB_LD="ld -shared"
+ DL_OBJS="tclLoadDld.o"
+ DL_LIBS="-ldld"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+ if test "`uname -m`" = "alpha" ; then
+ EXTRA_CFLAGS="-mieee"
+ fi
+ ;;
+ MP-RAS-02*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ MP-RAS-*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="-Wl,-Bexport"
+ LD_SEARCH_FLAGS=""
+ ;;
+ NetBSD-*|FreeBSD-[1-2].*|OpenBSD-*)
+ # Not available on all versions: check for include file.
+ ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
+echo "configure:1841: checking for dlfcn.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1846 "configure"
+#include "confdefs.h"
+#include <dlfcn.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+
+ # NetBSD/SPARC needs -fPIC, -fpic will not do.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ echo $ac_n "checking for ELF""... $ac_c" 1>&6
+echo "configure:1878: checking for ELF" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 1880 "configure"
+#include "confdefs.h"
+
+#ifdef __ELF__
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
+else
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
+
+fi
+rm -f conftest*
+
+
+else
+ echo "$ac_t""no" 1>&6
+
+ SHLIB_CFLAGS=""
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".a"
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+
+fi
+
+
+ # FreeBSD doesn't handle version numbers with dots.
+
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ FreeBSD-*)
+ # FreeBSD 3.* and greater have ELF.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS="-export-dynamic"
+ LD_SEARCH_FLAGS=""
+ ;;
+ NEXTSTEP-*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="cc -nostdlib -r"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadNext.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OS/390-*)
+ CFLAGS_OPTIMIZE="" # Optimizer is buggy
+ cat >> confdefs.h <<\EOF
+#define _OE_SOCKETS 1
+EOF
+ # needed in sys/socket.h
+ ;;
+ OSF1-1.0|OSF1-1.1|OSF1-1.2)
+ # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
+ SHLIB_CFLAGS=""
+ # Hack: make package name same as library name
+ SHLIB_LD='ld -R -export :'
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadOSF.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OSF1-1.*)
+ # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -shared"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OSF1-V*)
+ # Digital OSF/1
+ SHLIB_CFLAGS=""
+ SHLIB_LD='ld -shared -expect_unresolved "*"'
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ if test "$using_gcc" = "no" ; then
+ EXTRA_CFLAGS="-DHAVE_TZSET -std1"
+ fi
+ # see pthread_intro(3) for pthread support on osf1, k.furukawa
+ if test "${TCL_THREADS}" = "1" ; then
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
+ if test "$using_gcc" = "no" ; then
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread"
+ LDFLAGS="-pthread"
+ else
+ LIBS=`echo $LIBS | sed s/-lpthreads//`
+ LIBS="$LIBS -lpthread -lmach -lexc"
+ fi
+ fi
+
+ ;;
+ RISCos-*)
+ SHLIB_CFLAGS="-G 0"
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".a"
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS="-Wl,-D,08000000"
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ ;;
+ SCO_SV-3.2*)
+ # Note, dlopen is available only on SCO 3.2.5 and greater. However,
+ # this test works, since "uname -s" was non-standard in 3.2.4 and
+ # below.
+ if test "$using_gcc" = "yes" ; then
+ SHLIB_CFLAGS="-fPIC -melf"
+ LDFLAGS="-melf -Wl,-Bexport"
+ else
+ SHLIB_CFLAGS="-Kpic -belf"
+ LDFLAGS="-belf -Wl,-Bexport"
+ fi
+ SHLIB_LD="ld -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS="-belf -Wl,-Bexport"
+ LD_SEARCH_FLAGS=""
+ ;;
+ SINIX*5.4*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ SunOS-4*)
+ SHLIB_CFLAGS="-PIC"
+ SHLIB_LD="ld"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+
+ # SunOS can't handle version numbers with dots in them in library
+ # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
+ # requires an extra version number at the end of .so file names.
+ # So, the library has to have a name like libtcl75.so.1.0
+
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ SunOS-5.[0-6]*)
+ SHLIB_CFLAGS="-KPIC"
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ ;;
+ SunOS-5*)
+ SHLIB_CFLAGS="-KPIC"
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ LDFLAGS=""
+
+ do64bit_ok=no
+ if test "$do64bit" = "yes" ; then
+ arch=`isainfo`
+ if test "$arch" = "sparcv9 sparc" ; then
+ if test "$using_gcc" = "no" ; then
+ do64bit_ok=yes
+ if test "$do64bitVIS" = "yes" ; then
+ EXTRA_CFLAGS="-xarch=v9a"
+ LDFLAGS="-xarch=v9a"
+ else
+ EXTRA_CFLAGS="-xarch=v9"
+ LDFLAGS="-xarch=v9"
+ fi
+ else
+ echo "configure: warning: "64bit mode not supported with GCC on $system"" 1>&2
+ fi
+ else
+ echo "configure: warning: "64bit mode only supported sparcv9 system"" 1>&2
+ fi
+ fi
+
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ if test "$using_gcc" = "yes" ; then
+ LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ else
+ LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ fi
+ ;;
+ ULTRIX-4.*)
+ SHLIB_CFLAGS="-G 0"
+ SHLIB_SUFFIX=".a"
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ SHLIB_LD_LIBS='${LIBS}'
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS="-Wl,-D,08000000"
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ if test "$using_gcc" = "no" ; then
+ EXTRA_CFLAGS="-DHAVE_TZSET -std1"
+ fi
+ ;;
+ UNIX_SV* | UnixWare-5*)
+ SHLIB_CFLAGS="-KPIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
+ # that don't grok the -Bexport option. Test that it does.
+ hold_ldflags=$LDFLAGS
+ echo $ac_n "checking for ld accepts -Bexport flag""... $ac_c" 1>&6
+echo "configure:2135: checking for ld accepts -Bexport flag" >&5
+ LDFLAGS="${LDFLAGS} -Wl,-Bexport"
+ cat > conftest.$ac_ext <<EOF
+#line 2138 "configure"
+#include "confdefs.h"
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:2145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ found=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ found=no
+fi
+rm -f conftest*
+ LDFLAGS=$hold_ldflags
+ echo "$ac_t""$found" 1>&6
+ if test $found = yes; then
+ LDFLAGS="-Wl,-Bexport"
+ else
+ LDFLAGS=""
+ fi
+ LD_SEARCH_FLAGS=""
+ ;;
+ esac
+
+ if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
+ echo "configure: warning: "64bit support being disabled -- don\'t know magic for this platform"" 1>&2
+ fi
+
+ # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
+ # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
+ # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
+ # to determine which of several header files defines the a.out file
+ # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
+ # support only a file format that is more or less version-7-compatible.
+ # In particular,
+ # - a.out files must begin with `struct exec'.
+ # - the N_TXTOFF on the `struct exec' must compute the seek address
+ # of the text segment
+ # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
+ # and a_entry fields.
+ # The following compilation should succeed if and only if either sys/exec.h
+ # or a.out.h is usable for the purpose.
+ #
+ # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
+ # `struct exec' includes a second header that contains information that
+ # duplicates the v7 fields that are needed.
+
+ if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
+ echo $ac_n "checking sys/exec.h""... $ac_c" 1>&6
+echo "configure:2191: checking sys/exec.h" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 2193 "configure"
+#include "confdefs.h"
+#include <sys/exec.h>
+int main() {
+
+ struct exec foo;
+ unsigned long seek;
+ int flag;
+#if defined(__mips) || defined(mips)
+ seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+#else
+ seek = N_TXTOFF (foo);
+#endif
+ flag = (foo.a_magic == OMAGIC);
+ return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+
+; return 0; }
+EOF
+if { (eval echo configure:2211: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ tcl_ok=usable
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ tcl_ok=unusable
+fi
+rm -f conftest*
+ echo "$ac_t""$tcl_ok" 1>&6
+ if test $tcl_ok = usable; then
+ cat >> confdefs.h <<\EOF
+#define USE_SYS_EXEC_H 1
+EOF
+
+ else
+ echo $ac_n "checking a.out.h""... $ac_c" 1>&6
+echo "configure:2229: checking a.out.h" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 2231 "configure"
+#include "confdefs.h"
+#include <a.out.h>
+int main() {
+
+ struct exec foo;
+ unsigned long seek;
+ int flag;
+#if defined(__mips) || defined(mips)
+ seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+#else
+ seek = N_TXTOFF (foo);
+#endif
+ flag = (foo.a_magic == OMAGIC);
+ return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+
+; return 0; }
+EOF
+if { (eval echo configure:2249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ tcl_ok=usable
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ tcl_ok=unusable
+fi
+rm -f conftest*
+ echo "$ac_t""$tcl_ok" 1>&6
+ if test $tcl_ok = usable; then
+ cat >> confdefs.h <<\EOF
+#define USE_A_OUT_H 1
+EOF
+
+ else
+ echo $ac_n "checking sys/exec_aout.h""... $ac_c" 1>&6
+echo "configure:2267: checking sys/exec_aout.h" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 2269 "configure"
+#include "confdefs.h"
+#include <sys/exec_aout.h>
+int main() {
+
+ struct exec foo;
+ unsigned long seek;
+ int flag;
+#if defined(__mips) || defined(mips)
+ seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+#else
+ seek = N_TXTOFF (foo);
+#endif
+ flag = (foo.a_midmag == OMAGIC);
+ return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+
+; return 0; }
+EOF
+if { (eval echo configure:2287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ tcl_ok=usable
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ tcl_ok=unusable
+fi
+rm -f conftest*
+ echo "$ac_t""$tcl_ok" 1>&6
+ if test $tcl_ok = usable; then
+ cat >> confdefs.h <<\EOF
+#define USE_SYS_EXEC_AOUT_H 1
+EOF
+
+ else
+ DL_OBJS=""
+ fi
+ fi
+ fi
+ fi
+
+ # Step 5: disable dynamic loading if requested via a command-line switch.
+
+ # Check whether --enable-load or --disable-load was given.
+if test "${enable_load+set}" = set; then
+ enableval="$enable_load"
+ tcl_ok=$enableval
+else
+ tcl_ok=yes
+fi
+
+ if test "$tcl_ok" = "no"; then
+ DL_OBJS=""
+ fi
+
+ if test "x$DL_OBJS" != "x" ; then
+ BUILD_DLTEST="\$(DLTEST_TARGETS)"
+ else
+ echo "Can't figure out how to do dynamic loading or shared libraries"
+ echo "on this system."
+ SHLIB_CFLAGS=""
+ SHLIB_LD=""
+ SHLIB_SUFFIX=""
+ DL_OBJS="tclLoadNone.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ BUILD_DLTEST=""
+ fi
+
+ # If we're running gcc, then change the C flags for compiling shared
+ # libraries to the right flags for gcc, instead of those for the
+ # standard manufacturer compiler.
+
+ if test "$DL_OBJS" != "tclLoadNone.o" ; then
+ if test "$using_gcc" = "yes" ; then
+ case $system in
+ AIX-*)
+ ;;
+ BSD/OS*)
+ ;;
+ IRIX*)
+ ;;
+ NetBSD-*|FreeBSD-*|OpenBSD-*)
+ ;;
+ RISCos-*)
+ ;;
+ SCO_SV-3.2*)
+ ;;
+ ULTRIX-4.*)
+ ;;
+ *)
+ SHLIB_CFLAGS="-fPIC"
+ ;;
+ esac
+ fi
+ fi
+
+ if test "$SHARED_LIB_SUFFIX" = "" ; then
+ SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
+ fi
+ if test "$UNSHARED_LIB_SUFFIX" = "" ; then
+ UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
+ fi
+
+# CYGNUS LOCAL
+ TCL_LIB_SUFFIX=.a
+
+# END CYGNUS LOCAL
+
+
+
+
+
+
+
+
+ echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
+echo "configure:2387: checking for build with symbols" >&5
+ # Check whether --enable-symbols or --disable-symbols was given.
+if test "${enable_symbols+set}" = set; then
+ enableval="$enable_symbols"
+ tcl_ok=$enableval
+else
+ tcl_ok=no
+fi
+
+ if test "$tcl_ok" = "yes"; then
+ CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
+ LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
+ DBGX=g
+ echo "$ac_t""yes" 1>&6
+ else
+ CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
+ LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
+ DBGX=""
+ echo "$ac_t""no" 1>&6
+ fi
-file=$TCL_BIN_DIR/tclConfig.sh
-. $file
-SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
-SHLIB_LD=$TCL_SHLIB_LD
-SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
-SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
-SHLIB_VERSION=$TCL_SHLIB_VERSION
-DL_LIBS=$TCL_DL_LIBS
-LD_FLAGS=$TCL_LD_FLAGS
LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}'
+TK_DBGX=${DBGX}
+
+#------------------------------------------------------------------------
# If Tcl and Tk are installed in different places, adjust the library
# search path to reflect this.
+#------------------------------------------------------------------------
if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
- LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}"
+ LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib"
+fi
+
+#--------------------------------------------------------------------
+# On a few very rare systems, all of the libm.a stuff is
+# already in libc.a. Set compiler flags accordingly.
+# Also, Linux requires the "ieee" library for math to work
+# right (and it must appear before "-lm").
+#--------------------------------------------------------------------
+
+echo $ac_n "checking for sin""... $ac_c" 1>&6
+echo "configure:2430: checking for sin" >&5
+if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2435 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char sin(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char sin();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_sin) || defined (__stub___sin)
+choke me
+#else
+sin();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_sin=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_sin=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'sin`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ MATH_LIBS=""
+else
+ echo "$ac_t""no" 1>&6
+MATH_LIBS="-lm"
+fi
+
+echo $ac_n "checking for main in -lieee""... $ac_c" 1>&6
+echo "configure:2479: checking for main in -lieee" >&5
+ac_lib_var=`echo ieee'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lieee $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2487 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:2494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ MATH_LIBS="-lieee $MATH_LIBS"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+#--------------------------------------------------------------------
+# On AIX systems, libbsd.a has to be linked in to support
+# non-blocking file IO. This library has to be linked in after
+# the MATH_LIBS or it breaks the pow() function. The way to
+# insure proper sequencing, is to add it to the tail of MATH_LIBS.
+# This library also supplies gettimeofday.
+#--------------------------------------------------------------------
+libbsd=no
+if test "`uname -s`" = "AIX" ; then
+ echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6
+echo "configure:2525: checking for gettimeofday in -lbsd" >&5
+ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lbsd $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2533 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gettimeofday();
+
+int main() {
+gettimeofday()
+; return 0; }
+EOF
+if { (eval echo configure:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ libbsd=yes
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $libbsd = yes; then
+ MATH_LIBS="$MATH_LIBS -lbsd"
+ fi
fi
#--------------------------------------------------------------------
-# Supply a substitute for stdlib.h if it doesn't define strtol,
-# strtoul, or strtod (which it doesn't in some versions of SunOS).
+# Supply a substitute for stdlib.h if it doesn't define strtol,
+# strtoul, or strtod (which it doesn't in some versions of SunOS).
#--------------------------------------------------------------------
echo $ac_n "checking stdlib.h""... $ac_c" 1>&6
-echo "configure:1396: checking stdlib.h" >&5
+echo "configure:2575: checking stdlib.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 1398 "configure"
+#line 2577 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1409,7 +2588,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 1413 "configure"
+#line 2592 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1423,7 +2602,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 1427 "configure"
+#line 2606 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1445,26 +2624,26 @@ fi
echo "$ac_t""$tk_ok" 1>&6
#--------------------------------------------------------------------
-# Include sys/select.h if it exists and if it supplies things
-# that appear to be useful and aren't already in sys/types.h.
-# This appears to be true only on the RS/6000 under AIX. Some
-# systems like OSF/1 have a sys/select.h that's of no use, and
-# other systems like SCO UNIX have a sys/select.h that's
-# pernicious. If "fd_set" isn't defined anywhere then set a
-# special flag.
+# Include sys/select.h if it exists and if it supplies things
+# that appear to be useful and aren't already in sys/types.h.
+# This appears to be true only on the RS/6000 under AIX. Some
+# systems like OSF/1 have a sys/select.h that's of no use, and
+# other systems like SCO UNIX have a sys/select.h that's
+# pernicious. If "fd_set" isn't defined anywhere then set a
+# special flag.
#--------------------------------------------------------------------
echo $ac_n "checking fd_set and sys/select""... $ac_c" 1>&6
-echo "configure:1459: checking fd_set and sys/select" >&5
+echo "configure:2638: checking fd_set and sys/select" >&5
cat > conftest.$ac_ext <<EOF
-#line 1461 "configure"
+#line 2640 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
fd_set readMask, writeMask;
; return 0; }
EOF
-if { (eval echo configure:1468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
tk_ok=yes
else
@@ -1476,7 +2655,7 @@ fi
rm -f conftest*
if test $tk_ok = no; then
cat > conftest.$ac_ext <<EOF
-#line 1480 "configure"
+#line 2659 "configure"
#include "confdefs.h"
#include <sys/select.h>
EOF
@@ -1503,17 +2682,17 @@ EOF
fi
#--------------------------------------------------------------------
-# Check for various typedefs and provide substitutes if
-# they don't exist.
+# Check for various typedefs and provide substitutes if
+# they don't exist.
#--------------------------------------------------------------------
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1512: checking for ANSI C header files" >&5
+echo "configure:2691: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1517 "configure"
+#line 2696 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1521,7 +2700,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2704: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1538,7 +2717,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1542 "configure"
+#line 2721 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1556,7 +2735,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1560 "configure"
+#line 2739 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1577,7 +2756,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1581 "configure"
+#line 2760 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1588,7 +2767,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1612,12 +2791,12 @@ EOF
fi
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:1616: checking for mode_t" >&5
+echo "configure:2795: checking for mode_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1621 "configure"
+#line 2800 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1645,12 +2824,12 @@ EOF
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1649: checking for pid_t" >&5
+echo "configure:2828: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1654 "configure"
+#line 2833 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1678,12 +2857,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1682: checking for size_t" >&5
+echo "configure:2861: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1687 "configure"
+#line 2866 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1711,12 +2890,12 @@ EOF
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:1715: checking for uid_t in sys/types.h" >&5
+echo "configure:2894: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1720 "configure"
+#line 2899 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -1753,17 +2932,17 @@ for ac_hdr in sys/time.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1757: checking for $ac_hdr" >&5
+echo "configure:2936: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1762 "configure"
+#line 2941 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1790,12 +2969,12 @@ fi
done
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1794: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:2973: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1799 "configure"
+#line 2978 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -1804,7 +2983,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:1808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -1825,6 +3004,38 @@ EOF
fi
+#-------------------------------------------
+# In OS/390 struct pwd has no pw_gecos field
+#-------------------------------------------
+
+echo $ac_n "checking pw_gecos in struct pwd""... $ac_c" 1>&6
+echo "configure:3013: checking pw_gecos in struct pwd" >&5
+cat > conftest.$ac_ext <<EOF
+#line 3015 "configure"
+#include "confdefs.h"
+#include <pwd.h>
+int main() {
+struct passwd pwd; pwd.pw_gecos;
+; return 0; }
+EOF
+if { (eval echo configure:3022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ tk_ok=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ tk_ok=no
+fi
+rm -f conftest*
+echo "$ac_t""$tk_ok" 1>&6
+if test $tk_ok = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_PW_GECOS 1
+EOF
+
+fi
+
#--------------------------------------------------------------------
# Locate the X11 header files and the X11 library archive. Try
# the ac_path_x macro first, but if it doesn't find the X stuff
@@ -1834,12 +3045,13 @@ fi
# no include files, so double-check its result just to be safe.
#--------------------------------------------------------------------
-# If we find X, set shell vars x_includes and x_libraries to the
+
+ # If we find X, set shell vars x_includes and x_libraries to the
# paths, otherwise set no_x=yes.
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:1843: checking for X" >&5
+echo "configure:3055: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -1901,12 +3113,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 1905 "configure"
+#line 3117 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1910: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3122: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1975,14 +3187,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1979 "configure"
+#line 3191 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:1986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@@ -2068,16 +3280,16 @@ else
echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
fi
-not_really_there=""
-if test "$no_x" = ""; then
- if test "$x_includes" = ""; then
- cat > conftest.$ac_ext <<EOF
-#line 2076 "configure"
+ not_really_there=""
+ if test "$no_x" = ""; then
+ if test "$x_includes" = ""; then
+ cat > conftest.$ac_ext <<EOF
+#line 3288 "configure"
#include "confdefs.h"
#include <X11/XIntrinsic.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2081: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2089,23 +3301,23 @@ else
not_really_there="yes"
fi
rm -f conftest*
- else
- if test ! -r $x_includes/X11/Intrinsic.h; then
- not_really_there="yes"
+ else
+ if test ! -r $x_includes/X11/Intrinsic.h; then
+ not_really_there="yes"
+ fi
fi
fi
-fi
-if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
- echo $ac_n "checking for X11 header files""... $ac_c" 1>&6
-echo "configure:2101: checking for X11 header files" >&5
- XINCLUDES="# no special path needed"
- cat > conftest.$ac_ext <<EOF
-#line 2104 "configure"
+ if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
+ echo $ac_n "checking for X11 header files""... $ac_c" 1>&6
+echo "configure:3313: checking for X11 header files" >&5
+ XINCLUDES="# no special path needed"
+ cat > conftest.$ac_ext <<EOF
+#line 3316 "configure"
#include "confdefs.h"
#include <X11/Intrinsic.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2109: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3321: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2117,51 +3329,51 @@ else
XINCLUDES="nope"
fi
rm -f conftest*
+ if test "$XINCLUDES" = nope; then
+ dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
+ for i in $dirs ; do
+ if test -r $i/X11/Intrinsic.h; then
+ echo "$ac_t""$i" 1>&6
+ XINCLUDES=" -I$i"
+ break
+ fi
+ done
+ fi
+ else
+ if test "$x_includes" != ""; then
+ XINCLUDES=-I$x_includes
+ else
+ XINCLUDES="# no special path needed"
+ fi
+ fi
if test "$XINCLUDES" = nope; then
- dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
- for i in $dirs ; do
- if test -r $i/X11/Intrinsic.h; then
+ echo "$ac_t""couldn't find any!" 1>&6
+ XINCLUDES="# no include files found"
+ fi
+
+ if test "$no_x" = yes; then
+ echo $ac_n "checking for X11 libraries""... $ac_c" 1>&6
+echo "configure:3357: checking for X11 libraries" >&5
+ XLIBSW=nope
+ dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
+ for i in $dirs ; do
+ if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
echo "$ac_t""$i" 1>&6
- XINCLUDES=" -I$i"
+ XLIBSW="-L$i -lX11"
+ x_libraries="$i"
break
fi
- done
- fi
-else
- if test "$x_includes" != ""; then
- XINCLUDES=-I$x_includes
+ done
else
- XINCLUDES="# no special path needed"
- fi
-fi
-if test "$XINCLUDES" = nope; then
- echo "$ac_t""couldn't find any!" 1>&6
- XINCLUDES="# no include files found"
-fi
-
-if test "$no_x" = yes; then
- echo $ac_n "checking for X11 libraries""... $ac_c" 1>&6
-echo "configure:2145: checking for X11 libraries" >&5
- XLIBSW=nope
- dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
- for i in $dirs ; do
- if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
- echo "$ac_t""$i" 1>&6
- XLIBSW="-L$i -lX11"
- x_libraries="$i"
- break
+ if test "$x_libraries" = ""; then
+ XLIBSW=-lX11
+ else
+ XLIBSW="-L$x_libraries -lX11"
fi
- done
-else
- if test "$x_libraries" = ""; then
- XLIBSW=-lX11
- else
- XLIBSW="-L$x_libraries -lX11"
fi
-fi
-if test "$XLIBSW" = nope ; then
- echo $ac_n "checking for XCreateWindow in -lXwindow""... $ac_c" 1>&6
-echo "configure:2165: checking for XCreateWindow in -lXwindow" >&5
+ if test "$XLIBSW" = nope ; then
+ echo $ac_n "checking for XCreateWindow in -lXwindow""... $ac_c" 1>&6
+echo "configure:3377: checking for XCreateWindow in -lXwindow" >&5
ac_lib_var=`echo Xwindow'_'XCreateWindow | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2169,7 +3381,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lXwindow $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2173 "configure"
+#line 3385 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2180,7 +3392,7 @@ int main() {
XCreateWindow()
; return 0; }
EOF
-if { (eval echo configure:2184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2200,11 +3412,12 @@ else
echo "$ac_t""no" 1>&6
fi
-fi
-if test "$XLIBSW" = nope ; then
- echo "$ac_t""couldn't find any! Using -lX11." 1>&6
- XLIBSW=-lX11
-fi
+ fi
+ if test "$XLIBSW" = nope ; then
+ echo "$ac_t""couldn't find any! Using -lX11." 1>&6
+ XLIBSW=-lX11
+ fi
+
#--------------------------------------------------------------------
# Various manipulations on the search path used at runtime to
@@ -2232,12 +3445,6 @@ fi
# variable LIB_RUNTIME_DIR.
eval "TK_CC_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
-TK_LD_SEARCH_FLAGS=`echo ${TK_CC_SEARCH_FLAGS} |sed -e "s|-Wl,||g" -e "s|,| |g"`
-
-# CYGNUS LOCAL: Don't hack TK_LD_SEARCH_FLAGS if SHLIB_LD is gcc.
-case "${SHLIB_LD}" in
- *gcc*) TK_LD_SEARCH_FLAGS="${TK_CC_SEARCH_FLAGS}" ;;
-esac
#
# CYGNUS LOCAL: statically link on Solaris, HPUX & SunOS so that
@@ -2288,11 +3495,8 @@ esac
fi
;;
#
-# gdb linked statically w/ SunOS or HPUX, but not hpux11 wide
+# gdb linked statically w/ SunOS or HPUX
#
- hppa*w-hp-hpux*)
- ;;
-
m68k-hp-hpux*|hppa*-hp-hpux*|sparc-sun-sunos*)
if test "x$x_libraries" != "x" ;
then
@@ -2311,6 +3515,18 @@ esac
#
# END CYGNUS LOCAL
+# The following case handles the differences between linking with "ld"
+# and the compiler
+
+case $SHLIB_LD in
+ *ld*)
+ TK_LD_SEARCH_FLAGS=`echo ${TK_CC_SEARCH_FLAGS} |sed -e "s|-Wl,||g" -e "s|,| |g"`
+ ;;
+ *)
+ TK_LD_SEARCH_FLAGS="${TK_CC_SEARCH_FLAGS}"
+ ;;
+esac
+
#--------------------------------------------------------------------
# Check for the existence of various libraries. The order here
# is important, so that then end up in the right order in the
@@ -2330,7 +3546,7 @@ esac
#--------------------------------------------------------------------
echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6
-echo "configure:2334: checking for main in -lXbsd" >&5
+echo "configure:3550: checking for main in -lXbsd" >&5
ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2338,14 +3554,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lXbsd $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2342 "configure"
+#line 3558 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2369,7 +3585,7 @@ fi
# CYGNUS LOCAL: Store any socket library(ies) in the cache, and don't
# mess up the cache values of the functions we check for.
echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
-echo "configure:2373: checking for socket libraries" >&5
+echo "configure:3589: checking for socket libraries" >&5
if eval "test \"`echo '$''{'tcl_cv_lib_sockets'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2377,12 +3593,12 @@ else
tk_checkBoth=0
unset ac_cv_func_connect
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:2381: checking for connect" >&5
+echo "configure:3597: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2386 "configure"
+#line 3602 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -2405,7 +3621,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:2409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -2428,7 +3644,7 @@ fi
if test "$tk_checkSocket" = 1; then
unset ac_cv_func_connect
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:2432: checking for main in -lsocket" >&5
+echo "configure:3648: checking for main in -lsocket" >&5
ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2436,14 +3652,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2440 "configure"
+#line 3656 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2470,12 +3686,12 @@ fi
LIBS="$LIBS -lsocket -lnsl"
unset ac_cv_func_accept
echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:2474: checking for accept" >&5
+echo "configure:3690: checking for accept" >&5
if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2479 "configure"
+#line 3695 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char accept(); below. */
@@ -2498,7 +3714,7 @@ accept();
; return 0; }
EOF
-if { (eval echo configure:2502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_accept=yes"
else
@@ -2525,12 +3741,12 @@ fi
tk_oldLibs=$LIBS
LIBS="$LIBS $tk_cv_lib_sockets"
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:2529: checking for gethostbyname" >&5
+echo "configure:3745: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2534 "configure"
+#line 3750 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -2553,7 +3769,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:2557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -2571,7 +3787,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:2575: checking for main in -lnsl" >&5
+echo "configure:3791: checking for main in -lnsl" >&5
ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2579,14 +3795,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2583 "configure"
+#line 3799 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2616,6 +3832,10 @@ fi
echo "$ac_t""$tcl_cv_lib_sockets" 1>&6
test -z "$tcl_cv_lib_sockets" || LIBS="$LIBS $tcl_cv_lib_sockets"
+# Add the threads support libraries
+
+LIBS="$LIBS$THREADS_LIBS"
+
#--------------------------------------------------------------------
# One more check related to the X libraries. The standard releases
# of Ultrix don't support the "xauth" mechanism, so send won't work
@@ -2629,13 +3849,13 @@ test -z "$tcl_cv_lib_sockets" || LIBS="$LIBS $tcl_cv_lib_sockets"
if test -d /usr/include/mit ; then
echo $ac_n "checking MIT X libraries""... $ac_c" 1>&6
-echo "configure:2633: checking MIT X libraries" >&5
+echo "configure:3853: checking MIT X libraries" >&5
tk_oldCFlags=$CFLAGS
CFLAGS="$CFLAGS -I/usr/include/mit"
tk_oldLibs=$LIBS
LIBS="$LIBS -lX11-mit"
cat > conftest.$ac_ext <<EOF
-#line 2639 "configure"
+#line 3859 "configure"
#include "confdefs.h"
#include <X11/Xlib.h>
@@ -2646,7 +3866,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:2650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
@@ -2673,12 +3893,12 @@ fi
MATH_LIBS=""
echo $ac_n "checking for sin""... $ac_c" 1>&6
-echo "configure:2677: checking for sin" >&5
+echo "configure:3897: checking for sin" >&5
if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2682 "configure"
+#line 3902 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char sin(); below. */
@@ -2701,7 +3921,7 @@ sin();
; return 0; }
EOF
-if { (eval echo configure:2705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_sin=yes"
else
@@ -2722,7 +3942,7 @@ MATH_LIBS="-lm"
fi
echo $ac_n "checking for main in -lieee""... $ac_c" 1>&6
-echo "configure:2726: checking for main in -lieee" >&5
+echo "configure:3946: checking for main in -lieee" >&5
ac_lib_var=`echo ieee'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2730,14 +3950,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lieee $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2734 "configure"
+#line 3954 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2764,14 +3984,14 @@ fi
#--------------------------------------------------------------------
echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:2768: checking whether char is unsigned" >&5
+echo "configure:3988: checking whether char is unsigned" >&5
if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$GCC" = yes; then
# GCC predefines this symbol on systems where it applies.
cat > conftest.$ac_ext <<EOF
-#line 2775 "configure"
+#line 3995 "configure"
#include "confdefs.h"
#ifdef __CHAR_UNSIGNED__
yes
@@ -2793,7 +4013,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2797 "configure"
+#line 4017 "configure"
#include "confdefs.h"
/* volatile prevents gcc2 from optimizing the test away on sparcs. */
#if !defined(__STDC__) || __STDC__ != 1
@@ -2803,7 +4023,7 @@ main() {
volatile char c = 255; exit(c < 0);
}
EOF
-if { (eval echo configure:2807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_char_unsigned=yes
else
@@ -2834,13 +4054,14 @@ fi
# "fixstrtod" (provided by Tcl) that corrects the error.
#--------------------------------------------------------------------
-echo $ac_n "checking for strtod""... $ac_c" 1>&6
-echo "configure:2839: checking for strtod" >&5
+
+ echo $ac_n "checking for strtod""... $ac_c" 1>&6
+echo "configure:4060: checking for strtod" >&5
if eval "test \"`echo '$''{'ac_cv_func_strtod'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2844 "configure"
+#line 4065 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char strtod(); below. */
@@ -2863,7 +4084,7 @@ strtod();
; return 0; }
EOF
-if { (eval echo configure:2867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_strtod=yes"
else
@@ -2877,111 +4098,654 @@ fi
if eval "test \"`echo '$ac_cv_func_'strtod`\" = yes"; then
echo "$ac_t""yes" 1>&6
- tk_strtod=1
+ tcl_strtod=1
else
echo "$ac_t""no" 1>&6
-tk_strtod=0
+tcl_strtod=0
fi
-if test "$tk_strtod" = 1; then
- echo $ac_n "checking for Solaris 2.4 strtod bug""... $ac_c" 1>&6
-echo "configure:2889: checking for Solaris 2.4 strtod bug" >&5
- if test "$cross_compiling" = yes; then
- tk_ok=0
+ if test "$tcl_strtod" = 1; then
+ echo $ac_n "checking for Solaris2.4/Tru64 strtod bugs""... $ac_c" 1>&6
+echo "configure:4110: checking for Solaris2.4/Tru64 strtod bugs" >&5
+ if test "$cross_compiling" = yes; then
+ tcl_ok=0
else
cat > conftest.$ac_ext <<EOF
-#line 2894 "configure"
+#line 4115 "configure"
#include "confdefs.h"
- extern double strtod();
- int main()
- {
- char *string = "NaN";
- char *term;
- strtod(string, &term);
- if ((term != string) && (term[-1] == 0)) {
- exit(1);
+ extern double strtod();
+ int main()
+ {
+ char *string = "NaN", *spaceString = " ";
+ char *term;
+ double value;
+ value = strtod(string, &term);
+ if ((term != string) && (term[-1] == 0)) {
+ exit(1);
+ }
+ value = strtod(spaceString, &term);
+ if (term == (spaceString+1)) {
+ exit(1);
+ }
+ exit(0);
}
- exit(0);
- }
EOF
-if { (eval echo configure:2909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
- tk_ok=1
+ tcl_ok=1
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
- tk_ok=0
+ tcl_ok=0
fi
rm -fr conftest*
fi
- if test "$tk_ok" = 1; then
- echo "$ac_t""ok" 1>&6
- else
- echo "$ac_t""buggy" 1>&6
- cat >> confdefs.h <<\EOF
+ if test "$tcl_ok" = 1; then
+ echo "$ac_t""ok" 1>&6
+ else
+ echo "$ac_t""buggy" 1>&6
+ LIBOBJS="$LIBOBJS fixstrtod.o"
+ cat >> confdefs.h <<\EOF
#define strtod fixstrtod
EOF
+ fi
fi
-fi
+
#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtk as a shared library instead of a static library.
#--------------------------------------------------------------------
-# Check whether --enable-shared or --disable-shared was given.
+
+ echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
+echo "configure:4167: checking how to build libraries" >&5
+ # Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
- ok=$enableval
+ tcl_ok=$enableval
else
- ok=no
+ tcl_ok=no
fi
-# CYGNUS LOCAL: on machines where static linking of libX11 is important,
-# it is also important to build a static libtk.
-if test -n "$suppress_enable_shared"; then
- ok=no
-fi
-# END CYGNUS LOCAL
+ if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ tcl_ok=$enableval
+ else
+ tcl_ok=no
+ fi
+
+ if test "$tcl_ok" = "yes" ; then
+ echo "$ac_t""shared" 1>&6
+ SHARED_BUILD=1
+ else
+ echo "$ac_t""static" 1>&6
+ SHARED_BUILD=0
+ cat >> confdefs.h <<\EOF
+#define STATIC_BUILD 1
+EOF
-TK_SHARED_LIB_FILE=
-TK_UNSHARED_LIB_FILE=
-if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then
- TK_SHARED_BUILD=1
+ fi
+
+
+eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
+eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}"
+
+if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
- eval "TK_LIB_FILE=libtk${TCL_SHARED_LIB_SUFFIX}"
- TK_SHARED_LIB_FILE="$TK_LIB_FILE"
- MAKE_LIB="\${SHLIB_LD} -o ${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${SHLIB_LD_LIBS}"
+
+ libname=tk
+ suffix=${TK_SHARED_LIB_SUFFIX}
+
+ case "${host}" in
+ *windows32* | *mingw32* | *cygwin*)
+ eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+ ;;
+ *)
+ eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+ ;;
+ esac
+
+ eval "long_libname=${long_libname}"
+
+ # Trick to replace DBGX with TCL_DBGX
+ DBGX='${TCL_DBGX}'
+ eval "long_libname=${long_libname}"
+
+ TK_LIB_FILE=$long_libname
+
+ MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${TCL_STUB_LIB_SPEC} \${LIBS}"
RANLIB=":"
+
+# TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
+ TCL_STUB_FLAGS=""
else
- TK_SHARED_BUILD=0
TK_SHLIB_CFLAGS=""
- eval "TK_LIB_FILE=libtk${TCL_UNSHARED_LIB_SUFFIX}"
- TK_UNSHARED_LIB_FILE="$TK_LIB_FILE"
- MAKE_LIB="ar cr ${TK_LIB_FILE} \${OBJS}"
-fi
+
+ libname=tk
+ suffix=${TK_UNSHARED_LIB_SUFFIX}
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "$GCC" != yes; then
+ eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+ else
+ eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+ fi
+ ;;
+ *)
+ eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+ ;;
+ esac
-TK_BUILD_INCLUDES="-I`cd $srcdir/../generic; pwd`"
+ eval "long_libname=${long_libname}"
+
+ # Trick to replace DBGX with TCL_DBGX
+ DBGX='${TCL_DBGX}'
+ eval "long_libname=${long_libname}"
+
+ TK_LIB_FILE=$long_libname
+
+ MAKE_LIB="\${STLIB_LD} \${TK_LIB_FILE} \${OBJS}"
+
+ TCL_STUB_FLAGS=""
+fi
# Note: in the following variable, it's important to use the absolute
# path name of the Tcl directory rather than "..": this is because
# AIX remembers this path and will attempt to use it at run-time to look
# up the Tcl library.
-if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- TK_BUILD_LIB_SPEC="-L`pwd` -ltk${VERSION}"
- TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}"
+if test "$SHARED_BUILD" = 0 -o $TCL_NEEDS_EXP_FILE = 0; then
+
+ libname=tk
+ version=$TK_VERSION
+
+ if test "$TCL_LIB_SUFFIX" = "" ; then
+ { echo "configure: error: The TCL_LIB_SUFFIX variable is not defined" 1>&2; exit 1; }
+ fi
+
+ # If the . character is not allowed in lib name, remove it from version
+ if test "${TCL_LIB_VERSIONS_OK}" != "ok"; then
+ version=`echo $version | tr -d .`
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "$GCC" != yes; then
+ eval "short_libname=\"${TCL_VENDOR_PREFIX}${libname}${version}${TCL_LIB_SUFFIX}\""
+ else
+ short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}${TCL_DBGX}"
+ fi
+ ;;
+ *)
+ short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}\${TCL_DBGX}"
+ ;;
+ esac
+
+ TK_LIB_FLAG=$short_libname
+
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "$GCC" != yes; then
+
+ val="`pwd`/${TK_LIB_FLAG}"
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable TK_BUILD_LIB_SPEC" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ TK_BUILD_LIB_SPEC=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ TK_BUILD_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ TK_BUILD_LIB_SPEC=$val
+ ;;
+ esac
+
+ else
+
+ val=`pwd`
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ dirname=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ dirname=$val
+ ;;
+ esac
+
+ TK_BUILD_LIB_SPEC="-L${dirname} ${TK_LIB_FLAG}"
+ fi
+ ;;
+ *)
+ TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}"
+ ;;
+ esac
+
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "$GCC" != yes; then
+
+ val="${exec_prefix}/lib/${TK_LIB_FLAG}"
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable TK_LIB_SPEC" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ TK_LIB_SPEC=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ TK_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ TK_LIB_SPEC=$val
+ ;;
+ esac
+
+ else
+
+ val=${exec_prefix}/lib
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ dirname=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ dirname=$val
+ ;;
+ esac
+
+ TK_LIB_SPEC="-L${dirname} ${TK_LIB_FLAG}"
+ fi
+ ;;
+ *)
+ TK_LIB_SPEC="-L${exec_prefix}/lib ${TK_LIB_FLAG}"
+ ;;
+ esac
+
+ TK_BUILD_EXP_FILE=""
+ TK_EXP_FILE=""
else
- TK_BUILD_LIB_SPEC="-L`pwd` -ltk`echo ${VERSION} | tr -d .`"
- TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}"
+ TK_BUILD_EXP_FILE="lib.exp"
+ eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}"
+
+ TK_BUILD_LIB_SPEC="-bI:`pwd`/${TK_BUILD_EXP_FILE}"
+ TK_LIB_SPEC="-bI:${exec_prefix}/lib/${TK_EXP_FILE}"
fi
+TK_SHARED_BUILD=${SHARED_BUILD}
+
+TK_BUILD_INCLUDES="-I`cd $srcdir/../generic; pwd`"
+
+#--------------------------------------------------------------------
+# The statements below define various symbols relating to creating
+# the stub'd version of the Tk library
+#
+# For now, linking to Tcl stubs is not supported with Tk. It causes
+# too many problems with linking. When Tk is a fully loadable
+# extension, linking the the Tcl stubs will be supported.
+#--------------------------------------------------------------------
+
+
+ libname=tkstub
+ suffix=${TK_UNSHARED_LIB_SUFFIX}
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "$GCC" != yes; then
+ eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+ else
+ eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+ fi
+ ;;
+ *)
+ eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
+ ;;
+ esac
+
+ eval "long_libname=${long_libname}"
+
+ # Trick to replace DBGX with TCL_DBGX
+ DBGX='${TCL_DBGX}'
+ eval "long_libname=${long_libname}"
+
+ TK_STUB_LIB_FILE=$long_libname
+
+
+MAKE_STUB_LIB="\${STLIB_LD} \${STUB_LIB_FILE} \${STUB_LIB_OBJS}"
+
+
+ libname=tkstub
+ version=${TK_VERSION}
+
+ if test "$TCL_LIB_SUFFIX" = "" ; then
+ { echo "configure: error: The TCL_LIB_SUFFIX variable is not defined" 1>&2; exit 1; }
+ fi
+
+ # If the . character is not allowed in lib name, remove it from version
+ if test "${TCL_LIB_VERSIONS_OK}" != "ok"; then
+ version=`echo $version | tr -d .`
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "$GCC" != yes; then
+ eval "short_libname=\"${TCL_VENDOR_PREFIX}${libname}${version}${TCL_LIB_SUFFIX}\""
+ else
+ short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}${TCL_DBGX}"
+ fi
+ ;;
+ *)
+ short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}\${TCL_DBGX}"
+ ;;
+ esac
+
+ TK_STUB_LIB_FLAG=$short_libname
+
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "$GCC" != yes; then
+
+ val="`pwd`/${TK_STUB_LIB_FLAG}"
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable TK_BUILD_STUB_LIB_SPEC" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ TK_BUILD_STUB_LIB_SPEC=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ TK_BUILD_STUB_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ TK_BUILD_STUB_LIB_SPEC=$val
+ ;;
+ esac
+
+ else
+
+ val=`pwd`
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ dirname=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ dirname=$val
+ ;;
+ esac
+
+ TK_BUILD_STUB_LIB_SPEC="-L${dirname} ${TK_STUB_LIB_FLAG}"
+ fi
+ ;;
+ *)
+ TK_BUILD_STUB_LIB_SPEC="-L`pwd` ${TK_STUB_LIB_FLAG}"
+ ;;
+ esac
+
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "$GCC" != yes; then
+
+ val="${exec_prefix}/lib/${TK_STUB_LIB_FLAG}"
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable TK_STUB_LIB_SPEC" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ TK_STUB_LIB_SPEC=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ TK_STUB_LIB_SPEC="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ TK_STUB_LIB_SPEC=$val
+ ;;
+ esac
+
+ else
+
+ val=${exec_prefix}/lib
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable dirname" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ dirname=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ dirname="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ dirname=$val
+ ;;
+ esac
+
+ TK_STUB_LIB_SPEC="-L${dirname} ${TK_STUB_LIB_FLAG}"
+ fi
+ ;;
+ *)
+ TK_STUB_LIB_SPEC="-L${exec_prefix}/lib ${TK_STUB_LIB_FLAG}"
+ ;;
+ esac
+
+
+
+
+ val="`pwd`/${TK_STUB_LIB_FILE}"
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable TK_BUILD_STUB_LIB_PATH" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ TK_BUILD_STUB_LIB_PATH=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ TK_BUILD_STUB_LIB_PATH="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ TK_BUILD_STUB_LIB_PATH=$val
+ ;;
+ esac
+
+
+
+
+ val="`pwd`/${TK_STUB_LIB_FILE}"
+
+ if test "$val" = "" ; then
+ { echo "configure: error: Empty value for variable TK_STUB_LIB_PATH" 1>&2; exit 1; }
+ fi
+
+ case "${host}" in
+ *windows32* | *mingw32*)
+ if test "${CYGPATH}" = ""; then
+ { echo "configure: error: CYGPATH variable is not defined." 1>&2; exit 1; }
+ elif test "${CYGPATH}" = "echo"; then
+ # No cygpath when cross compiling
+ TK_STUB_LIB_PATH=$val
+ else
+ # store literal argument text in a variable
+ val=$val
+ # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
+ val="`${CYGPATH} $val`"
+ # Convert path like C:\Tmp\foo to C:/Tmp/foo
+ TK_STUB_LIB_PATH="`echo $val | sed -e s#\\\\\\\\#/#g`"
+ fi
+ ;;
+ *)
+ # Default to a no-op under Unix or Cygwin gcc
+ TK_STUB_LIB_PATH=$val
+ ;;
+ esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-TK_LIB_FULL_PATH="`pwd`/${TK_LIB_FILE}"
@@ -3132,7 +4896,6 @@ do
done
ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile tkConfig.sh" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
@@ -3166,57 +4929,67 @@ s%@includedir@%$includedir%g
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@CC@%$CC%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@RANLIB@%$RANLIB%g
+s%@CC@%$CC%g
s%@CPP@%$CPP%g
+s%@TCL_BIN_DIR@%$TCL_BIN_DIR%g
+s%@TCL_SRC_DIR@%$TCL_SRC_DIR%g
+s%@TCL_LIB_FILE@%$TCL_LIB_FILE%g
+s%@AR@%$AR%g
+s%@TCL_LIB_SUFFIX@%$TCL_LIB_SUFFIX%g
s%@DL_LIBS@%$DL_LIBS%g
-s%@LD_FLAGS@%$LD_FLAGS%g
+s%@CFLAGS_DEBUG@%$CFLAGS_DEBUG%g
+s%@CFLAGS_OPTIMIZE@%$CFLAGS_OPTIMIZE%g
+s%@CFLAGS_WARNING@%$CFLAGS_WARNING%g
+s%@TK_STUB_LIB_FILE@%$TK_STUB_LIB_FILE%g
+s%@TK_STUB_LIB_FLAG@%$TK_STUB_LIB_FLAG%g
+s%@TK_BUILD_STUB_LIB_SPEC@%$TK_BUILD_STUB_LIB_SPEC%g
+s%@TK_STUB_LIB_SPEC@%$TK_STUB_LIB_SPEC%g
+s%@TK_BUILD_STUB_LIB_PATH@%$TK_BUILD_STUB_LIB_PATH%g
+s%@TK_STUB_LIB_PATH@%$TK_STUB_LIB_PATH%g
+s%@MAKE_STUB_LIB@%$MAKE_STUB_LIB%g
+s%@TK_STUB_FLAGS@%$TK_STUB_FLAGS%g
+s%@TK_BUILD_EXP_FILE@%$TK_BUILD_EXP_FILE%g
+s%@TK_EXP_FILE@%$TK_EXP_FILE%g
+s%@TCL_STUB_FLAGS@%$TCL_STUB_FLAGS%g
+s%@CFLAGS_DEFAULT@%$CFLAGS_DEFAULT%g
+s%@LDFLAGS_DEFAULT@%$LDFLAGS_DEFAULT%g
+s%@LDFLAGS_DEBUG@%$LDFLAGS_DEBUG%g
+s%@LDFLAGS_OPTIMIZE@%$LDFLAGS_OPTIMIZE%g
+s%@TK_DBGX@%$TK_DBGX%g
+s%@EXTRA_CFLAGS@%$EXTRA_CFLAGS%g
s%@MATH_LIBS@%$MATH_LIBS%g
s%@MAKE_LIB@%$MAKE_LIB%g
s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g
+s%@TK_SHLIB_CFLAGS@%$TK_SHLIB_CFLAGS%g
+s%@STLIB_LD@%$STLIB_LD%g
s%@SHLIB_LD@%$SHLIB_LD%g
s%@SHLIB_LD_LIBS@%$SHLIB_LD_LIBS%g
s%@SHLIB_SUFFIX@%$SHLIB_SUFFIX%g
s%@SHLIB_VERSION@%$SHLIB_VERSION%g
-s%@TCL_BIN_DIR@%$TCL_BIN_DIR%g
+s%@TCL_LIB_FULL_PATH@%$TCL_LIB_FULL_PATH%g
+s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
+s%@TCL_LIB_FLAG@%$TCL_LIB_FLAG%g
+s%@TCL_BUILD_STUB_LIB_SPEC@%$TCL_BUILD_STUB_LIB_SPEC%g
s%@TCL_BUILD_LIB_SPEC@%$TCL_BUILD_LIB_SPEC%g
-s%@TCL_SRC_DIR@%$TCL_SRC_DIR%g
+s%@TCL_DBGX@%$TCL_DBGX%g
s%@TCL_VERSION@%$TCL_VERSION%g
-s%@TK_BUILD_INCLUDES@%$TK_BUILD_INCLUDES%g
s%@TK_BUILD_LIB_SPEC@%$TK_BUILD_LIB_SPEC%g
+s%@TK_LIB_FULL_PATH@%$TK_LIB_FULL_PATH%g
s%@TK_CC_SEARCH_FLAGS@%$TK_CC_SEARCH_FLAGS%g
s%@TK_LD_SEARCH_FLAGS@%$TK_LD_SEARCH_FLAGS%g
-s%@TK_LIB_FULL_PATH@%$TK_LIB_FULL_PATH%g
s%@TK_LIB_FILE@%$TK_LIB_FILE%g
s%@TK_LIB_FLAG@%$TK_LIB_FLAG%g
s%@TK_LIB_SPEC@%$TK_LIB_SPEC%g
s%@TK_MAJOR_VERSION@%$TK_MAJOR_VERSION%g
s%@TK_MINOR_VERSION@%$TK_MINOR_VERSION%g
s%@TK_PATCH_LEVEL@%$TK_PATCH_LEVEL%g
-s%@TK_SHLIB_CFLAGS@%$TK_SHLIB_CFLAGS%g
s%@TK_SRC_DIR@%$TK_SRC_DIR%g
s%@TK_VERSION@%$TK_VERSION%g
s%@XINCLUDES@%$XINCLUDES%g
s%@XLIBSW@%$XLIBSW%g
s%@TK_SHARED_BUILD@%$TK_SHARED_BUILD%g
+s%@TK_BUILD_INCLUDES@%$TK_BUILD_INCLUDES%g
s%@TCL_SHARED_LIB_SUFFIX@%$TCL_SHARED_LIB_SUFFIX%g
s%@TCL_UNSHARED_LIB_SUFFIX@%$TCL_UNSHARED_LIB_SUFFIX%g
s%@TK_SHARED_LIB_FILE@%$TK_SHARED_LIB_FILE%g
@@ -3297,10 +5070,6 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
top_srcdir="$ac_dots$ac_given_srcdir" ;;
esac
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
echo creating "$ac_file"
rm -f "$ac_file"
@@ -3316,7 +5085,6 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
rm -f conftest.s*
@@ -3333,3 +5101,4 @@ chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/tk/unix/configure.in b/tk/unix/configure.in
index 49f3f2d4e6a..cdc7eabfe47 100755
--- a/tk/unix/configure.in
+++ b/tk/unix/configure.in
@@ -1,26 +1,20 @@
-! /bin/bash -norc
+#! /bin/bash -norc
dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tk installation
dnl to configure the system for the local environment.
+# RCS: @(#) $Id$
# CYGNUS LOCAL, autoconf 2.5 or higher to get --bindir et al
AC_PREREQ(2.5)
# END CYGNUS LOCAL
AC_INIT(../generic/tk.h)
-# SCCS: @(#) configure.in 1.90 97/11/20 12:45:45
+# RCS: @(#) $Id$
-# CYGNUS LOCAL tromey - find config.guess/config.sub in our tree
-AC_CONFIG_AUX_DIR($srcdir/../..)
-AC_CANONICAL_SYSTEM
-AC_PROG_CC
-AC_PROG_INSTALL
-# END CYGNUS LOCAL
-
-TK_VERSION=8.0
+TK_VERSION=8.3
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=0
-TK_PATCH_LEVEL=".4"
+TK_MINOR_VERSION=3
+TK_PATCH_LEVEL=".2"
VERSION=${TK_VERSION}
if test "${prefix}" = "NONE"; then
@@ -29,74 +23,94 @@ fi
if test "${exec_prefix}" = "NONE"; then
exec_prefix=$prefix
fi
-TK_SRC_DIR=`cd $srcdir/..; pwd`
+# Make sure srcdir is fully qualified!
+srcdir=`cd $srcdir ; pwd`
+TCL_TOOL_PATH(TK_SRC_DIR, "`cd $srcdir/..; pwd`")
AC_PROG_RANLIB
-AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available],
- [tk_ok=$enableval], [tkl_ok=no])
-if test "$tk_ok" = "yes"; then
- AC_PROG_CC
-else
- CC=${CC-cc}
-AC_SUBST(CC)
-fi
+AC_PROG_CC
+
AC_HAVE_HEADERS(unistd.h limits.h)
-# set the warning flags depending on whether or not we are using gcc
-if test "${GCC}" = "yes" ; then
- # leave -Wimplicit-int out, the X libs generate so many of these warnings
- # that they obscure everything else.
+#------------------------------------------------------------------------
+# Threads support
+#------------------------------------------------------------------------
- CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
-else
- CFLAGS_WARNING=""
+SC_ENABLE_THREADS
+
+#------------------------------------------------------------------------------
+# If we're using GCC, see if the compiler understands -pipe. If so, use it.
+# It makes compiling go faster. (This is only a performance feature.)
+#------------------------------------------------------------------------------
+
+if test -z "$no_pipe"; then
+if test -n "$GCC"; then
+ AC_MSG_CHECKING([if the compiler understands -pipe])
+ OLDCC="$CC"
+ CC="$CC -pipe"
+ AC_TRY_COMPILE(,,
+ AC_MSG_RESULT(yes),
+ CC="$OLDCC"
+ AC_MSG_RESULT(no))
+fi
fi
#--------------------------------------------------------------------
-# See if there was a command-line option for where Tcl is; if
-# not, assume that its top-level directory is a sibling of ours.
+# Find and load the tclConfig.sh file
#--------------------------------------------------------------------
-AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.0 binaries from DIR],
- TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd ../../tcl/unix; pwd`)
-if test -z "$TCL_BIN_DIR"; then
- AC_MSG_ERROR(couldn't find Tcl build directory in ../../tcl/unix)
-fi
-if test ! -d $TCL_BIN_DIR; then
- AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR doesn't exist)
-fi
-if test ! -f $TCL_BIN_DIR/Makefile; then
- AC_MSG_ERROR(There's no Makefile in $TCL_BIN_DIR; perhaps you didn't specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?)
-fi
+SC_PATH_TCLCONFIG
+SC_LOAD_TCLCONFIG
#--------------------------------------------------------------------
-# Read in configuration information generated by Tcl for shared
-# libraries, and arrange for it to be substituted into our
-# Makefile.
+# Recompute the necessary flags to run the compiler
#--------------------------------------------------------------------
-file=$TCL_BIN_DIR/tclConfig.sh
-. $file
-SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
-SHLIB_LD=$TCL_SHLIB_LD
-SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
-SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
-SHLIB_VERSION=$TCL_SHLIB_VERSION
-DL_LIBS=$TCL_DL_LIBS
-LD_FLAGS=$TCL_LD_FLAGS
+SC_CONFIG_CFLAGS
+
+SC_ENABLE_SYMBOLS
LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}'
+TK_DBGX=${DBGX}
+
+#------------------------------------------------------------------------
# If Tcl and Tk are installed in different places, adjust the library
# search path to reflect this.
+#------------------------------------------------------------------------
if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
- LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}"
+ LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib"
fi
#--------------------------------------------------------------------
-# Supply a substitute for stdlib.h if it doesn't define strtol,
-# strtoul, or strtod (which it doesn't in some versions of SunOS).
+# On a few very rare systems, all of the libm.a stuff is
+# already in libc.a. Set compiler flags accordingly.
+# Also, Linux requires the "ieee" library for math to work
+# right (and it must appear before "-lm").
+#--------------------------------------------------------------------
+
+AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
+AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
+
+#--------------------------------------------------------------------
+# On AIX systems, libbsd.a has to be linked in to support
+# non-blocking file IO. This library has to be linked in after
+# the MATH_LIBS or it breaks the pow() function. The way to
+# insure proper sequencing, is to add it to the tail of MATH_LIBS.
+# This library also supplies gettimeofday.
+#--------------------------------------------------------------------
+libbsd=no
+if test "`uname -s`" = "AIX" ; then
+ AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
+ if test $libbsd = yes; then
+ MATH_LIBS="$MATH_LIBS -lbsd"
+ fi
+fi
+
+#--------------------------------------------------------------------
+# Supply a substitute for stdlib.h if it doesn't define strtol,
+# strtoul, or strtod (which it doesn't in some versions of SunOS).
#--------------------------------------------------------------------
AC_MSG_CHECKING(stdlib.h)
@@ -109,13 +123,13 @@ fi
AC_MSG_RESULT($tk_ok)
#--------------------------------------------------------------------
-# Include sys/select.h if it exists and if it supplies things
-# that appear to be useful and aren't already in sys/types.h.
-# This appears to be true only on the RS/6000 under AIX. Some
-# systems like OSF/1 have a sys/select.h that's of no use, and
-# other systems like SCO UNIX have a sys/select.h that's
-# pernicious. If "fd_set" isn't defined anywhere then set a
-# special flag.
+# Include sys/select.h if it exists and if it supplies things
+# that appear to be useful and aren't already in sys/types.h.
+# This appears to be true only on the RS/6000 under AIX. Some
+# systems like OSF/1 have a sys/select.h that's of no use, and
+# other systems like SCO UNIX have a sys/select.h that's
+# pernicious. If "fd_set" isn't defined anywhere then set a
+# special flag.
#--------------------------------------------------------------------
AC_MSG_CHECKING([fd_set and sys/select])
@@ -133,14 +147,14 @@ if test $tk_ok = no; then
fi
#--------------------------------------------------------------------
-# Check for various typedefs and provide substitutes if
-# they don't exist.
+# Check for various typedefs and provide substitutes if
+# they don't exist.
#--------------------------------------------------------------------
-AC_MODE_T
-AC_PID_T
-AC_SIZE_T
-AC_UID_T
+AC_TYPE_MODE_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_TYPE_UID_T
#------------------------------------------------------------------------------
# Find out about time handling differences.
@@ -149,6 +163,18 @@ AC_UID_T
AC_CHECK_HEADERS(sys/time.h)
AC_HEADER_TIME
+#-------------------------------------------
+# In OS/390 struct pwd has no pw_gecos field
+#-------------------------------------------
+
+AC_MSG_CHECKING([pw_gecos in struct pwd])
+AC_TRY_COMPILE([#include <pwd.h>],
+ [struct passwd pwd; pwd.pw_gecos;], tk_ok=yes, tk_ok=no)
+AC_MSG_RESULT($tk_ok)
+if test $tk_ok = yes; then
+ AC_DEFINE(HAVE_PW_GECOS)
+fi
+
#--------------------------------------------------------------------
# Locate the X11 header files and the X11 library archive. Try
# the ac_path_x macro first, but if it doesn't find the X stuff
@@ -158,69 +184,7 @@ AC_HEADER_TIME
# no include files, so double-check its result just to be safe.
#--------------------------------------------------------------------
-AC_PATH_X
-not_really_there=""
-if test "$no_x" = ""; then
- if test "$x_includes" = ""; then
- AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
- else
- if test ! -r $x_includes/X11/Intrinsic.h; then
- not_really_there="yes"
- fi
- fi
-fi
-if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
- AC_MSG_CHECKING(for X11 header files)
- XINCLUDES="# no special path needed"
- AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
- if test "$XINCLUDES" = nope; then
- dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
- for i in $dirs ; do
- if test -r $i/X11/Intrinsic.h; then
- AC_MSG_RESULT($i)
- XINCLUDES=" -I$i"
- break
- fi
- done
- fi
-else
- if test "$x_includes" != ""; then
- XINCLUDES=-I$x_includes
- else
- XINCLUDES="# no special path needed"
- fi
-fi
-if test "$XINCLUDES" = nope; then
- AC_MSG_RESULT(couldn't find any!)
- XINCLUDES="# no include files found"
-fi
-
-if test "$no_x" = yes; then
- AC_MSG_CHECKING(for X11 libraries)
- XLIBSW=nope
- dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
- for i in $dirs ; do
- if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
- AC_MSG_RESULT($i)
- XLIBSW="-L$i -lX11"
- x_libraries="$i"
- break
- fi
- done
-else
- if test "$x_libraries" = ""; then
- XLIBSW=-lX11
- else
- XLIBSW="-L$x_libraries -lX11"
- fi
-fi
-if test "$XLIBSW" = nope ; then
- AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
-fi
-if test "$XLIBSW" = nope ; then
- AC_MSG_RESULT(couldn't find any! Using -lX11.)
- XLIBSW=-lX11
-fi
+SC_PATH_X
#--------------------------------------------------------------------
# Various manipulations on the search path used at runtime to
@@ -248,12 +212,6 @@ fi
# variable LIB_RUNTIME_DIR.
eval "TK_CC_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
-TK_LD_SEARCH_FLAGS=`echo ${TK_CC_SEARCH_FLAGS} |sed -e "s|-Wl,||g" -e "s|,| |g"`
-
-# CYGNUS LOCAL: Don't hack TK_LD_SEARCH_FLAGS if SHLIB_LD is gcc.
-case "${SHLIB_LD}" in
- *gcc*) TK_LD_SEARCH_FLAGS="${TK_CC_SEARCH_FLAGS}" ;;
-esac
#
# CYGNUS LOCAL: statically link on Solaris, HPUX & SunOS so that
@@ -304,11 +262,8 @@ esac
fi
;;
#
-# gdb linked statically w/ SunOS or HPUX, but not hpux11 wide
+# gdb linked statically w/ SunOS or HPUX
#
- hppa*w-hp-hpux*)
- ;;
-
m68k-hp-hpux*|hppa*-hp-hpux*|sparc-sun-sunos*)
if test "x$x_libraries" != "x" ;
then
@@ -327,6 +282,18 @@ esac
#
# END CYGNUS LOCAL
+# The following case handles the differences between linking with "ld"
+# and the compiler
+
+case $SHLIB_LD in
+ *ld*)
+ TK_LD_SEARCH_FLAGS=`echo ${TK_CC_SEARCH_FLAGS} |sed -e "s|-Wl,||g" -e "s|,| |g"`
+ ;;
+ *)
+ TK_LD_SEARCH_FLAGS="${TK_CC_SEARCH_FLAGS}"
+ ;;
+esac
+
#--------------------------------------------------------------------
# Check for the existence of various libraries. The order here
# is important, so that then end up in the right order in the
@@ -380,6 +347,10 @@ AC_CACHE_CHECK([for socket libraries], tcl_cv_lib_sockets,
])
test -z "$tcl_cv_lib_sockets" || LIBS="$LIBS $tcl_cv_lib_sockets"
+# Add the threads support libraries
+
+LIBS="$LIBS$THREADS_LIBS"
+
#--------------------------------------------------------------------
# One more check related to the X libraries. The standard releases
# of Ultrix don't support the "xauth" mechanism, so send won't work
@@ -435,113 +406,141 @@ AC_C_CHAR_UNSIGNED
# "fixstrtod" (provided by Tcl) that corrects the error.
#--------------------------------------------------------------------
-AC_CHECK_FUNC(strtod, tk_strtod=1, tk_strtod=0)
-if test "$tk_strtod" = 1; then
- AC_MSG_CHECKING([for Solaris 2.4 strtod bug])
- AC_TRY_RUN([
- extern double strtod();
- int main()
- {
- char *string = "NaN";
- char *term;
- strtod(string, &term);
- if ((term != string) && (term[-1] == 0)) {
- exit(1);
- }
- exit(0);
- }], tk_ok=1, tk_ok=0, tk_ok=0)
- if test "$tk_ok" = 1; then
- AC_MSG_RESULT(ok)
- else
- AC_MSG_RESULT(buggy)
- AC_DEFINE(strtod, fixstrtod)
- fi
-fi
+SC_BUGGY_STRTOD
#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtk as a shared library instead of a static library.
#--------------------------------------------------------------------
-AC_ARG_ENABLE(shared,
- [ --enable-shared build libtk as a shared library],
- [ok=$enableval], [ok=no])
+SC_ENABLE_SHARED
-# CYGNUS LOCAL: on machines where static linking of libX11 is important,
-# it is also important to build a static libtk.
-if test -n "$suppress_enable_shared"; then
- ok=no
-fi
-# END CYGNUS LOCAL
+eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
+eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}"
-TK_SHARED_LIB_FILE=
-TK_UNSHARED_LIB_FILE=
-if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then
- TK_SHARED_BUILD=1
+if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
- eval "TK_LIB_FILE=libtk${TCL_SHARED_LIB_SUFFIX}"
- TK_SHARED_LIB_FILE="$TK_LIB_FILE"
- MAKE_LIB="\${SHLIB_LD} -o ${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${SHLIB_LD_LIBS}"
+ TCL_TOOL_SHARED_LIB_LONGNAME(TK_LIB_FILE, tk, ${TK_SHARED_LIB_SUFFIX})
+ MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${TCL_STUB_LIB_SPEC} \${LIBS}"
RANLIB=":"
+
+# TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
+ TCL_STUB_FLAGS=""
else
- TK_SHARED_BUILD=0
TK_SHLIB_CFLAGS=""
- eval "TK_LIB_FILE=libtk${TCL_UNSHARED_LIB_SUFFIX}"
- TK_UNSHARED_LIB_FILE="$TK_LIB_FILE"
- MAKE_LIB="ar cr ${TK_LIB_FILE} \${OBJS}"
-fi
+ TCL_TOOL_STATIC_LIB_LONGNAME(TK_LIB_FILE, tk, ${TK_UNSHARED_LIB_SUFFIX})
+ MAKE_LIB="\${STLIB_LD} \${TK_LIB_FILE} \${OBJS}"
-dnl CYGNUS LOCAL
-TK_BUILD_INCLUDES="-I`cd $srcdir/../generic; pwd`"
-dnl END CYGNUS LOCAL
+ TCL_STUB_FLAGS=""
+fi
# Note: in the following variable, it's important to use the absolute
# path name of the Tcl directory rather than "..": this is because
# AIX remembers this path and will attempt to use it at run-time to look
# up the Tcl library.
-if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
- TK_BUILD_LIB_SPEC="-L`pwd` -ltk${VERSION}"
- TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}"
+if test "$SHARED_BUILD" = 0 -o $TCL_NEEDS_EXP_FILE = 0; then
+ TCL_TOOL_LIB_SHORTNAME(TK_LIB_FLAG, tk, $TK_VERSION)
+ TCL_TOOL_LIB_SPEC(TK_BUILD_LIB_SPEC, `pwd`, ${TK_LIB_FLAG})
+ TCL_TOOL_LIB_SPEC(TK_LIB_SPEC, ${exec_prefix}/lib, ${TK_LIB_FLAG})
+ TK_BUILD_EXP_FILE=""
+ TK_EXP_FILE=""
else
- TK_BUILD_LIB_SPEC="-L`pwd` -ltk`echo ${VERSION} | tr -d .`"
- TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}"
+ TK_BUILD_EXP_FILE="lib.exp"
+ eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}"
+
+ TK_BUILD_LIB_SPEC="-bI:`pwd`/${TK_BUILD_EXP_FILE}"
+ TK_LIB_SPEC="-bI:${exec_prefix}/lib/${TK_EXP_FILE}"
fi
+TK_SHARED_BUILD=${SHARED_BUILD}
+
+dnl CYGNUS LOCAL
+TK_BUILD_INCLUDES="-I`cd $srcdir/../generic; pwd`"
+dnl END CYGNUS LOCAL
-TK_LIB_FULL_PATH="`pwd`/${TK_LIB_FILE}"
+#--------------------------------------------------------------------
+# The statements below define various symbols relating to creating
+# the stub'd version of the Tk library
+#
+# For now, linking to Tcl stubs is not supported with Tk. It causes
+# too many problems with linking. When Tk is a fully loadable
+# extension, linking the the Tcl stubs will be supported.
+#--------------------------------------------------------------------
+TCL_TOOL_STATIC_LIB_LONGNAME(TK_STUB_LIB_FILE, tkstub, ${TK_UNSHARED_LIB_SUFFIX})
+
+MAKE_STUB_LIB="\${STLIB_LD} \${STUB_LIB_FILE} \${STUB_LIB_OBJS}"
+
+TCL_TOOL_LIB_SHORTNAME(TK_STUB_LIB_FLAG, tkstub, ${TK_VERSION})
+TCL_TOOL_LIB_SPEC(TK_BUILD_STUB_LIB_SPEC, `pwd`, ${TK_STUB_LIB_FLAG})
+TCL_TOOL_LIB_SPEC(TK_STUB_LIB_SPEC, ${exec_prefix}/lib, ${TK_STUB_LIB_FLAG})
+
+TCL_TOOL_LIB_PATH(TK_BUILD_STUB_LIB_PATH, `pwd`, ${TK_STUB_LIB_FILE})
+TCL_TOOL_LIB_PATH(TK_STUB_LIB_PATH, `pwd`, ${TK_STUB_LIB_FILE})
+
+AC_SUBST(TK_STUB_LIB_FILE)
+AC_SUBST(TK_STUB_LIB_FLAG)
+AC_SUBST(TK_BUILD_STUB_LIB_SPEC)
+AC_SUBST(TK_STUB_LIB_SPEC)
+AC_SUBST(TK_BUILD_STUB_LIB_PATH)
+AC_SUBST(TK_STUB_LIB_PATH)
+AC_SUBST(MAKE_STUB_LIB)
+AC_SUBST(TK_STUB_FLAGS)
+AC_SUBST(TK_BUILD_EXP_FILE)
+AC_SUBST(TK_EXP_FILE)
+
+AC_SUBST(TCL_STUB_FLAGS)
+AC_SUBST(TK_BUILD_EXP_FILE)
+AC_SUBST(TK_EXP_FILE)
+
+AC_SUBST(CFLAGS_DEFAULT)
+AC_SUBST(CFLAGS_DEBUG)
+AC_SUBST(CFLAGS_OPTIMIZE)
+AC_SUBST(LDFLAGS_DEFAULT)
+AC_SUBST(LDFLAGS_DEBUG)
+AC_SUBST(LDFLAGS_OPTIMIZE)
+AC_SUBST(TK_DBGX)
AC_SUBST(DL_LIBS)
-AC_SUBST(LD_FLAGS)
+AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(MATH_LIBS)
+AC_SUBST(AR)
+AC_SUBST(RANLIB)
AC_SUBST(MAKE_LIB)
AC_SUBST(SHLIB_CFLAGS)
+AC_SUBST(TK_SHLIB_CFLAGS)
+AC_SUBST(STLIB_LD)
AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_LD_LIBS)
AC_SUBST(SHLIB_SUFFIX)
AC_SUBST(SHLIB_VERSION)
AC_SUBST(TCL_BIN_DIR)
+AC_SUBST(TCL_LIB_FULL_PATH)
+AC_SUBST(TCL_LIB_SPEC)
+AC_SUBST(TCL_LIB_FLAG)
+AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
AC_SUBST(TCL_BUILD_LIB_SPEC)
+AC_SUBST(TCL_DBGX)
+AC_SUBST(TCL_LIB_FLAG)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_VERSION)
-dnl CYGNUS LOCAL
-AC_SUBST(TK_BUILD_INCLUDES)
-dnl END CYGNUS LOCAL
AC_SUBST(TK_BUILD_LIB_SPEC)
+AC_SUBST(TK_LIB_FULL_PATH)
AC_SUBST(TK_CC_SEARCH_FLAGS)
AC_SUBST(TK_LD_SEARCH_FLAGS)
-AC_SUBST(TK_LIB_FULL_PATH)
AC_SUBST(TK_LIB_FILE)
AC_SUBST(TK_LIB_FLAG)
AC_SUBST(TK_LIB_SPEC)
AC_SUBST(TK_MAJOR_VERSION)
AC_SUBST(TK_MINOR_VERSION)
AC_SUBST(TK_PATCH_LEVEL)
-AC_SUBST(TK_SHLIB_CFLAGS)
AC_SUBST(TK_SRC_DIR)
AC_SUBST(TK_VERSION)
AC_SUBST(XINCLUDES)
AC_SUBST(XLIBSW)
AC_SUBST(TK_SHARED_BUILD)
+dnl CYGNUS LOCAL
+AC_SUBST(TK_BUILD_INCLUDES)
+dnl END CYGNUS LOCAL
# CYGNUS LOCAL
# Need more variables to keep shared/static linking separate.
AC_SUBST(TCL_SHARED_LIB_SUFFIX)
@@ -551,3 +550,4 @@ AC_SUBST(TK_UNSHARED_LIB_FILE)
# END CYGNUS LOCAL
AC_OUTPUT(Makefile tkConfig.sh)
+
diff --git a/tk/unix/mkLinks b/tk/unix/mkLinks
index 0bbeb5d05b3..95356941219 100755
--- a/tk/unix/mkLinks
+++ b/tk/unix/mkLinks
@@ -27,169 +27,174 @@ rm xyzzyTe*
if test "$x" != "xyzzyTestingAVeryLongFileName.foo"; then
exit
fi
+
if test -r 3DBorder.3; then
+ rm -f Tk_Alloc3DBorderFromObj.3
+ rm -f Tk_Get3DBorder.3
+ rm -f Tk_Get3DBorderFromObj.3
+ rm -f Tk_Draw3DRectangle.3
+ rm -f Tk_Fill3DRectangle.3
+ rm -f Tk_Draw3DPolygon.3
+ rm -f Tk_Fill3DPolygon.3
+ rm -f Tk_3DVerticalBevel.3
+ rm -f Tk_3DHorizontalBevel.3
+ rm -f Tk_SetBackgroundFromBorder.3
+ rm -f Tk_NameOf3DBorder.3
rm -f Tk_3DBorderColor.3
- cp 3DBorder.3 Tk_3DBorderColor.3
-fi
-if test -r 3DBorder.3; then
rm -f Tk_3DBorderGC.3
- cp 3DBorder.3 Tk_3DBorderGC.3
-fi
-if test -r 3DBorder.3; then
- rm -f Tk_3DHorizontalBevel.3
- cp 3DBorder.3 Tk_3DHorizontalBevel.3
-fi
-if test -r 3DBorder.3; then
- rm -f Tk_3DVerticalBevel.3
+ rm -f Tk_Free3DBorderFromObj.3
+ rm -f Tk_Free3DBorder.3
+ cp 3DBorder.3 Tk_Alloc3DBorderFromObj.3
+ cp 3DBorder.3 Tk_Get3DBorder.3
+ cp 3DBorder.3 Tk_Get3DBorderFromObj.3
+ cp 3DBorder.3 Tk_Draw3DRectangle.3
+ cp 3DBorder.3 Tk_Fill3DRectangle.3
+ cp 3DBorder.3 Tk_Draw3DPolygon.3
+ cp 3DBorder.3 Tk_Fill3DPolygon.3
cp 3DBorder.3 Tk_3DVerticalBevel.3
+ cp 3DBorder.3 Tk_3DHorizontalBevel.3
+ cp 3DBorder.3 Tk_SetBackgroundFromBorder.3
+ cp 3DBorder.3 Tk_NameOf3DBorder.3
+ cp 3DBorder.3 Tk_3DBorderColor.3
+ cp 3DBorder.3 Tk_3DBorderGC.3
+ cp 3DBorder.3 Tk_Free3DBorderFromObj.3
+ cp 3DBorder.3 Tk_Free3DBorder.3
fi
-if test -r WindowId.3; then
- rm -f Tk_Attributes.3
- cp WindowId.3 Tk_Attributes.3
+if test -r AddOption.3; then
+ rm -f Tk_AddOption.3
+ cp AddOption.3 Tk_AddOption.3
fi
if test -r BindTable.3; then
+ rm -f Tk_CreateBindingTable.3
+ rm -f Tk_DeleteBindingTable.3
+ rm -f Tk_CreateBinding.3
+ rm -f Tk_DeleteBinding.3
+ rm -f Tk_GetBinding.3
+ rm -f Tk_GetAllBindings.3
+ rm -f Tk_DeleteAllBindings.3
rm -f Tk_BindEvent.3
+ cp BindTable.3 Tk_CreateBindingTable.3
+ cp BindTable.3 Tk_DeleteBindingTable.3
+ cp BindTable.3 Tk_CreateBinding.3
+ cp BindTable.3 Tk_DeleteBinding.3
+ cp BindTable.3 Tk_GetBinding.3
+ cp BindTable.3 Tk_GetAllBindings.3
+ cp BindTable.3 Tk_DeleteAllBindings.3
cp BindTable.3 Tk_BindEvent.3
fi
-if test -r CanvTkwin.3; then
- rm -f Tk_CanvasDrawableCoords.3
- cp CanvTkwin.3 Tk_CanvasDrawableCoords.3
-fi
-if test -r CanvTkwin.3; then
- rm -f Tk_CanvasEventuallyRedraw.3
- cp CanvTkwin.3 Tk_CanvasEventuallyRedraw.3
-fi
-if test -r CanvTkwin.3; then
- rm -f Tk_CanvasGetCoord.3
- cp CanvTkwin.3 Tk_CanvasGetCoord.3
-fi
if test -r CanvPsY.3; then
+ rm -f Tk_CanvasPsY.3
rm -f Tk_CanvasPsBitmap.3
- cp CanvPsY.3 Tk_CanvasPsBitmap.3
-fi
-if test -r CanvPsY.3; then
rm -f Tk_CanvasPsColor.3
- cp CanvPsY.3 Tk_CanvasPsColor.3
-fi
-if test -r CanvPsY.3; then
rm -f Tk_CanvasPsFont.3
- cp CanvPsY.3 Tk_CanvasPsFont.3
-fi
-if test -r CanvPsY.3; then
rm -f Tk_CanvasPsPath.3
- cp CanvPsY.3 Tk_CanvasPsPath.3
-fi
-if test -r CanvPsY.3; then
rm -f Tk_CanvasPsStipple.3
- cp CanvPsY.3 Tk_CanvasPsStipple.3
-fi
-if test -r CanvPsY.3; then
- rm -f Tk_CanvasPsY.3
cp CanvPsY.3 Tk_CanvasPsY.3
+ cp CanvPsY.3 Tk_CanvasPsBitmap.3
+ cp CanvPsY.3 Tk_CanvasPsColor.3
+ cp CanvPsY.3 Tk_CanvasPsFont.3
+ cp CanvPsY.3 Tk_CanvasPsPath.3
+ cp CanvPsY.3 Tk_CanvasPsStipple.3
fi
if test -r CanvTkwin.3; then
+ rm -f Tk_CanvasTkwin.3
+ rm -f Tk_CanvasGetCoord.3
+ rm -f Tk_CanvasDrawableCoords.3
rm -f Tk_CanvasSetStippleOrigin.3
- cp CanvTkwin.3 Tk_CanvasSetStippleOrigin.3
-fi
-if test -r CanvTkwin.3; then
+ rm -f Tk_CanvasWindowCoords.3
+ rm -f Tk_CanvasEventuallyRedraw.3
rm -f Tk_CanvasTagsOption.3
+ cp CanvTkwin.3 Tk_CanvasTkwin.3
+ cp CanvTkwin.3 Tk_CanvasGetCoord.3
+ cp CanvTkwin.3 Tk_CanvasDrawableCoords.3
+ cp CanvTkwin.3 Tk_CanvasSetStippleOrigin.3
+ cp CanvTkwin.3 Tk_CanvasWindowCoords.3
+ cp CanvTkwin.3 Tk_CanvasEventuallyRedraw.3
cp CanvTkwin.3 Tk_CanvasTagsOption.3
fi
if test -r CanvTxtInfo.3; then
rm -f Tk_CanvasTextInfo.3
cp CanvTxtInfo.3 Tk_CanvasTextInfo.3
fi
-if test -r CanvTkwin.3; then
- rm -f Tk_CanvasTkwin.3
- cp CanvTkwin.3 Tk_CanvasTkwin.3
-fi
-if test -r CanvTkwin.3; then
- rm -f Tk_CanvasWindowCoords.3
- cp CanvTkwin.3 Tk_CanvasWindowCoords.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_ChangeWindowAttributes.3
- cp ConfigWind.3 Tk_ChangeWindowAttributes.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_Changes.3
- cp WindowId.3 Tk_Changes.3
-fi
-if test -r TextLayout.3; then
- rm -f Tk_CharBbox.3
- cp TextLayout.3 Tk_CharBbox.3
-fi
-if test -r SetClass.3; then
- rm -f Tk_Class.3
- cp SetClass.3 Tk_Class.3
-fi
-if test -r ClrSelect.3; then
- rm -f Tk_ClearSelection.3
- cp ClrSelect.3 Tk_ClearSelection.3
-fi
-if test -r Clipboard.3; then
- rm -f Tk_ClipboardAppend.3
- cp Clipboard.3 Tk_ClipboardAppend.3
-fi
if test -r Clipboard.3; then
rm -f Tk_ClipboardClear.3
+ rm -f Tk_ClipboardAppend.3
cp Clipboard.3 Tk_ClipboardClear.3
+ cp Clipboard.3 Tk_ClipboardAppend.3
fi
-if test -r WindowId.3; then
- rm -f Tk_Colormap.3
- cp WindowId.3 Tk_Colormap.3
-fi
-if test -r TextLayout.3; then
- rm -f Tk_ComputeTextLayout.3
- cp TextLayout.3 Tk_ComputeTextLayout.3
+if test -r ClrSelect.3; then
+ rm -f Tk_ClearSelection.3
+ cp ClrSelect.3 Tk_ClearSelection.3
fi
if test -r ConfigWidg.3; then
+ rm -f Tk_ConfigureWidget.3
+ rm -f Tk_Offset.3
rm -f Tk_ConfigureInfo.3
- cp ConfigWidg.3 Tk_ConfigureInfo.3
-fi
-if test -r ConfigWidg.3; then
rm -f Tk_ConfigureValue.3
- cp ConfigWidg.3 Tk_ConfigureValue.3
-fi
-if test -r ConfigWidg.3; then
- rm -f Tk_ConfigureWidget.3
+ rm -f Tk_FreeOptions.3
cp ConfigWidg.3 Tk_ConfigureWidget.3
+ cp ConfigWidg.3 Tk_Offset.3
+ cp ConfigWidg.3 Tk_ConfigureInfo.3
+ cp ConfigWidg.3 Tk_ConfigureValue.3
+ cp ConfigWidg.3 Tk_FreeOptions.3
fi
if test -r ConfigWind.3; then
rm -f Tk_ConfigureWindow.3
+ rm -f Tk_MoveWindow.3
+ rm -f Tk_ResizeWindow.3
+ rm -f Tk_MoveResizeWindow.3
+ rm -f Tk_SetWindowBorderWidth.3
+ rm -f Tk_ChangeWindowAttributes.3
+ rm -f Tk_SetWindowBackground.3
+ rm -f Tk_SetWindowBackgroundPixmap.3
+ rm -f Tk_SetWindowBorder.3
+ rm -f Tk_SetWindowBorderPixmap.3
+ rm -f Tk_SetWindowColormap.3
+ rm -f Tk_DefineCursor.3
+ rm -f Tk_UndefineCursor.3
cp ConfigWind.3 Tk_ConfigureWindow.3
+ cp ConfigWind.3 Tk_MoveWindow.3
+ cp ConfigWind.3 Tk_ResizeWindow.3
+ cp ConfigWind.3 Tk_MoveResizeWindow.3
+ cp ConfigWind.3 Tk_SetWindowBorderWidth.3
+ cp ConfigWind.3 Tk_ChangeWindowAttributes.3
+ cp ConfigWind.3 Tk_SetWindowBackground.3
+ cp ConfigWind.3 Tk_SetWindowBackgroundPixmap.3
+ cp ConfigWind.3 Tk_SetWindowBorder.3
+ cp ConfigWind.3 Tk_SetWindowBorderPixmap.3
+ cp ConfigWind.3 Tk_SetWindowColormap.3
+ cp ConfigWind.3 Tk_DefineCursor.3
+ cp ConfigWind.3 Tk_UndefineCursor.3
fi
if test -r CoordToWin.3; then
rm -f Tk_CoordsToWindow.3
cp CoordToWin.3 Tk_CoordsToWindow.3
fi
-if test -r BindTable.3; then
- rm -f Tk_CreateBinding.3
- cp BindTable.3 Tk_CreateBinding.3
-fi
-if test -r BindTable.3; then
- rm -f Tk_CreateBindingTable.3
- cp BindTable.3 Tk_CreateBindingTable.3
-fi
if test -r CrtErrHdlr.3; then
rm -f Tk_CreateErrorHandler.3
+ rm -f Tk_DeleteErrorHandler.3
cp CrtErrHdlr.3 Tk_CreateErrorHandler.3
-fi
-if test -r EventHndlr.3; then
- rm -f Tk_CreateEventHandler.3
- cp EventHndlr.3 Tk_CreateEventHandler.3
+ cp CrtErrHdlr.3 Tk_DeleteErrorHandler.3
fi
if test -r CrtGenHdlr.3; then
rm -f Tk_CreateGenericHandler.3
+ rm -f Tk_DeleteGenericHandler.3
cp CrtGenHdlr.3 Tk_CreateGenericHandler.3
+ cp CrtGenHdlr.3 Tk_DeleteGenericHandler.3
fi
if test -r CrtImgType.3; then
rm -f Tk_CreateImageType.3
+ rm -f Tk_GetImageMasterData.3
+ rm -f Tk_InitImageArgs.3
cp CrtImgType.3 Tk_CreateImageType.3
+ cp CrtImgType.3 Tk_GetImageMasterData.3
+ cp CrtImgType.3 Tk_InitImageArgs.3
fi
if test -r CrtItemType.3; then
rm -f Tk_CreateItemType.3
+ rm -f Tk_GetItemTypes.3
cp CrtItemType.3 Tk_CreateItemType.3
+ cp CrtItemType.3 Tk_GetItemTypes.3
fi
if test -r CrtPhImgFmt.3; then
rm -f Tk_CreatePhotoImageFormat.3
@@ -197,159 +202,59 @@ if test -r CrtPhImgFmt.3; then
fi
if test -r CrtSelHdlr.3; then
rm -f Tk_CreateSelHandler.3
+ rm -f Tk_DeleteSelHandler.3
cp CrtSelHdlr.3 Tk_CreateSelHandler.3
+ cp CrtSelHdlr.3 Tk_DeleteSelHandler.3
fi
if test -r CrtWindow.3; then
rm -f Tk_CreateWindow.3
- cp CrtWindow.3 Tk_CreateWindow.3
-fi
-if test -r CrtWindow.3; then
rm -f Tk_CreateWindowFromPath.3
+ rm -f Tk_DestroyWindow.3
+ rm -f Tk_MakeWindowExist.3
+ cp CrtWindow.3 Tk_CreateWindow.3
cp CrtWindow.3 Tk_CreateWindowFromPath.3
-fi
-if test -r GetBitmap.3; then
- rm -f Tk_DefineBitmap.3
- cp GetBitmap.3 Tk_DefineBitmap.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_DefineCursor.3
- cp ConfigWind.3 Tk_DefineCursor.3
-fi
-if test -r BindTable.3; then
- rm -f Tk_DeleteAllBindings.3
- cp BindTable.3 Tk_DeleteAllBindings.3
-fi
-if test -r BindTable.3; then
- rm -f Tk_DeleteBinding.3
- cp BindTable.3 Tk_DeleteBinding.3
-fi
-if test -r BindTable.3; then
- rm -f Tk_DeleteBindingTable.3
- cp BindTable.3 Tk_DeleteBindingTable.3
-fi
-if test -r CrtErrHdlr.3; then
- rm -f Tk_DeleteErrorHandler.3
- cp CrtErrHdlr.3 Tk_DeleteErrorHandler.3
-fi
-if test -r EventHndlr.3; then
- rm -f Tk_DeleteEventHandler.3
- cp EventHndlr.3 Tk_DeleteEventHandler.3
-fi
-if test -r CrtGenHdlr.3; then
- rm -f Tk_DeleteGenericHandler.3
- cp CrtGenHdlr.3 Tk_DeleteGenericHandler.3
+ cp CrtWindow.3 Tk_DestroyWindow.3
+ cp CrtWindow.3 Tk_MakeWindowExist.3
fi
if test -r DeleteImg.3; then
rm -f Tk_DeleteImage.3
cp DeleteImg.3 Tk_DeleteImage.3
fi
-if test -r CrtSelHdlr.3; then
- rm -f Tk_DeleteSelHandler.3
- cp CrtSelHdlr.3 Tk_DeleteSelHandler.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_Depth.3
- cp WindowId.3 Tk_Depth.3
-fi
-if test -r CrtWindow.3; then
- rm -f Tk_DestroyWindow.3
- cp CrtWindow.3 Tk_DestroyWindow.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_Display.3
- cp WindowId.3 Tk_Display.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_DisplayName.3
- cp WindowId.3 Tk_DisplayName.3
-fi
-if test -r TextLayout.3; then
- rm -f Tk_DistanceToTextLayout.3
- cp TextLayout.3 Tk_DistanceToTextLayout.3
-fi
-if test -r 3DBorder.3; then
- rm -f Tk_Draw3DPolygon.3
- cp 3DBorder.3 Tk_Draw3DPolygon.3
-fi
-if test -r 3DBorder.3; then
- rm -f Tk_Draw3DRectangle.3
- cp 3DBorder.3 Tk_Draw3DRectangle.3
-fi
-if test -r MeasureChar.3; then
- rm -f Tk_DrawChars.3
- cp MeasureChar.3 Tk_DrawChars.3
-fi
if test -r DrawFocHlt.3; then
rm -f Tk_DrawFocusHighlight.3
cp DrawFocHlt.3 Tk_DrawFocusHighlight.3
fi
-if test -r TextLayout.3; then
- rm -f Tk_DrawTextLayout.3
- cp TextLayout.3 Tk_DrawTextLayout.3
-fi
-if test -r 3DBorder.3; then
- rm -f Tk_Fill3DPolygon.3
- cp 3DBorder.3 Tk_Fill3DPolygon.3
-fi
-if test -r 3DBorder.3; then
- rm -f Tk_Fill3DRectangle.3
- cp 3DBorder.3 Tk_Fill3DRectangle.3
+if test -r EventHndlr.3; then
+ rm -f Tk_CreateEventHandler.3
+ rm -f Tk_DeleteEventHandler.3
+ cp EventHndlr.3 Tk_CreateEventHandler.3
+ cp EventHndlr.3 Tk_DeleteEventHandler.3
fi
if test -r FindPhoto.3; then
rm -f Tk_FindPhoto.3
+ rm -f Tk_PhotoPutBlock.3
+ rm -f Tk_PhotoPutZoomedBlock.3
+ rm -f Tk_PhotoGetImage.3
+ rm -f Tk_PhotoBlank.3
+ rm -f Tk_PhotoExpand.3
+ rm -f Tk_PhotoGetSize.3
+ rm -f Tk_PhotoSetSize.3
cp FindPhoto.3 Tk_FindPhoto.3
+ cp FindPhoto.3 Tk_PhotoPutBlock.3
+ cp FindPhoto.3 Tk_PhotoPutZoomedBlock.3
+ cp FindPhoto.3 Tk_PhotoGetImage.3
+ cp FindPhoto.3 Tk_PhotoBlank.3
+ cp FindPhoto.3 Tk_PhotoExpand.3
+ cp FindPhoto.3 Tk_PhotoGetSize.3
+ cp FindPhoto.3 Tk_PhotoSetSize.3
fi
if test -r FontId.3; then
rm -f Tk_FontId.3
- cp FontId.3 Tk_FontId.3
-fi
-if test -r FontId.3; then
rm -f Tk_FontMetrics.3
+ rm -f Tk_PostscriptFontName.3
+ cp FontId.3 Tk_FontId.3
cp FontId.3 Tk_FontMetrics.3
-fi
-if test -r 3DBorder.3; then
- rm -f Tk_Free3DBorder.3
- cp 3DBorder.3 Tk_Free3DBorder.3
-fi
-if test -r GetBitmap.3; then
- rm -f Tk_FreeBitmap.3
- cp GetBitmap.3 Tk_FreeBitmap.3
-fi
-if test -r GetColor.3; then
- rm -f Tk_FreeColor.3
- cp GetColor.3 Tk_FreeColor.3
-fi
-if test -r GetClrmap.3; then
- rm -f Tk_FreeColormap.3
- cp GetClrmap.3 Tk_FreeColormap.3
-fi
-if test -r GetCursor.3; then
- rm -f Tk_FreeCursor.3
- cp GetCursor.3 Tk_FreeCursor.3
-fi
-if test -r GetFont.3; then
- rm -f Tk_FreeFont.3
- cp GetFont.3 Tk_FreeFont.3
-fi
-if test -r GetGC.3; then
- rm -f Tk_FreeGC.3
- cp GetGC.3 Tk_FreeGC.3
-fi
-if test -r GetImage.3; then
- rm -f Tk_FreeImage.3
- cp GetImage.3 Tk_FreeImage.3
-fi
-if test -r ConfigWidg.3; then
- rm -f Tk_FreeOptions.3
- cp ConfigWidg.3 Tk_FreeOptions.3
-fi
-if test -r GetPixmap.3; then
- rm -f Tk_FreePixmap.3
- cp GetPixmap.3 Tk_FreePixmap.3
-fi
-if test -r TextLayout.3; then
- rm -f Tk_FreeTextLayout.3
- cp TextLayout.3 Tk_FreeTextLayout.3
+ cp FontId.3 Tk_PostscriptFontName.3
fi
if test -r FreeXId.3; then
rm -f Tk_FreeXId.3
@@ -357,115 +262,175 @@ if test -r FreeXId.3; then
fi
if test -r GeomReq.3; then
rm -f Tk_GeometryRequest.3
+ rm -f Tk_SetInternalBorder.3
cp GeomReq.3 Tk_GeometryRequest.3
-fi
-if test -r 3DBorder.3; then
- rm -f Tk_Get3DBorder.3
- cp 3DBorder.3 Tk_Get3DBorder.3
-fi
-if test -r BindTable.3; then
- rm -f Tk_GetAllBindings.3
- cp BindTable.3 Tk_GetAllBindings.3
+ cp GeomReq.3 Tk_SetInternalBorder.3
fi
if test -r GetAnchor.3; then
+ rm -f Tk_GetAnchorFromObj.3
rm -f Tk_GetAnchor.3
+ rm -f Tk_NameOfAnchor.3
+ cp GetAnchor.3 Tk_GetAnchorFromObj.3
cp GetAnchor.3 Tk_GetAnchor.3
-fi
-if test -r InternAtom.3; then
- rm -f Tk_GetAtomName.3
- cp InternAtom.3 Tk_GetAtomName.3
-fi
-if test -r BindTable.3; then
- rm -f Tk_GetBinding.3
- cp BindTable.3 Tk_GetBinding.3
+ cp GetAnchor.3 Tk_NameOfAnchor.3
fi
if test -r GetBitmap.3; then
+ rm -f Tk_AllocBitmapFromObj.3
rm -f Tk_GetBitmap.3
- cp GetBitmap.3 Tk_GetBitmap.3
-fi
-if test -r GetBitmap.3; then
+ rm -f Tk_GetBitmapFromObj.3
+ rm -f Tk_DefineBitmap.3
+ rm -f Tk_NameOfBitmap.3
+ rm -f Tk_SizeOfBitmap.3
+ rm -f Tk_FreeBitmapFromObj.3
+ rm -f Tk_FreeBitmap.3
rm -f Tk_GetBitmapFromData.3
+ cp GetBitmap.3 Tk_AllocBitmapFromObj.3
+ cp GetBitmap.3 Tk_GetBitmap.3
+ cp GetBitmap.3 Tk_GetBitmapFromObj.3
+ cp GetBitmap.3 Tk_DefineBitmap.3
+ cp GetBitmap.3 Tk_NameOfBitmap.3
+ cp GetBitmap.3 Tk_SizeOfBitmap.3
+ cp GetBitmap.3 Tk_FreeBitmapFromObj.3
+ cp GetBitmap.3 Tk_FreeBitmap.3
cp GetBitmap.3 Tk_GetBitmapFromData.3
fi
if test -r GetCapStyl.3; then
rm -f Tk_GetCapStyle.3
+ rm -f Tk_NameOfCapStyle.3
cp GetCapStyl.3 Tk_GetCapStyle.3
+ cp GetCapStyl.3 Tk_NameOfCapStyle.3
fi
-if test -r GetColor.3; then
- rm -f Tk_GetColor.3
- cp GetColor.3 Tk_GetColor.3
+if test -r GetClrmap.3; then
+ rm -f Tk_GetColormap.3
+ rm -f Tk_FreeColormap.3
+ cp GetClrmap.3 Tk_GetColormap.3
+ cp GetClrmap.3 Tk_FreeColormap.3
fi
if test -r GetColor.3; then
+ rm -f Tk_AllocColorFromObj.3
+ rm -f Tk_GetColor.3
+ rm -f Tk_GetColorFromObj.3
rm -f Tk_GetColorByValue.3
+ rm -f Tk_NameOfColor.3
+ rm -f Tk_FreeColorFromObj.3
+ rm -f Tk_FreeColor.3
+ cp GetColor.3 Tk_AllocColorFromObj.3
+ cp GetColor.3 Tk_GetColor.3
+ cp GetColor.3 Tk_GetColorFromObj.3
cp GetColor.3 Tk_GetColorByValue.3
-fi
-if test -r GetClrmap.3; then
- rm -f Tk_GetColormap.3
- cp GetClrmap.3 Tk_GetColormap.3
+ cp GetColor.3 Tk_NameOfColor.3
+ cp GetColor.3 Tk_FreeColorFromObj.3
+ cp GetColor.3 Tk_FreeColor.3
fi
if test -r GetCursor.3; then
+ rm -f Tk_AllocCursorFromObj.3
rm -f Tk_GetCursor.3
- cp GetCursor.3 Tk_GetCursor.3
-fi
-if test -r GetCursor.3; then
+ rm -f Tk_GetCursorFromObj.3
rm -f Tk_GetCursorFromData.3
+ rm -f Tk_NameOfCursor.3
+ rm -f Tk_FreeCursorFromObj.3
+ rm -f Tk_FreeCursor.3
+ cp GetCursor.3 Tk_AllocCursorFromObj.3
+ cp GetCursor.3 Tk_GetCursor.3
+ cp GetCursor.3 Tk_GetCursorFromObj.3
cp GetCursor.3 Tk_GetCursorFromData.3
+ cp GetCursor.3 Tk_NameOfCursor.3
+ cp GetCursor.3 Tk_FreeCursorFromObj.3
+ cp GetCursor.3 Tk_FreeCursor.3
+fi
+if test -r GetDash.3; then
+ rm -f Tk_GetDash.3
+ cp GetDash.3 Tk_GetDash.3
fi
if test -r GetFont.3; then
+ rm -f Tk_AllocFontFromObj.3
rm -f Tk_GetFont.3
+ rm -f Tk_GetFontFromObj.3
+ rm -f Tk_NameOfFont.3
+ rm -f Tk_FreeFontFromObj.3
+ rm -f Tk_FreeFont.3
+ cp GetFont.3 Tk_AllocFontFromObj.3
cp GetFont.3 Tk_GetFont.3
+ cp GetFont.3 Tk_GetFontFromObj.3
+ cp GetFont.3 Tk_NameOfFont.3
+ cp GetFont.3 Tk_FreeFontFromObj.3
+ cp GetFont.3 Tk_FreeFont.3
fi
if test -r GetGC.3; then
rm -f Tk_GetGC.3
+ rm -f Tk_FreeGC.3
cp GetGC.3 Tk_GetGC.3
+ cp GetGC.3 Tk_FreeGC.3
+fi
+if test -r GetHINSTANCE.3; then
+ rm -f Tk_GetHINSTANCE.3
+ cp GetHINSTANCE.3 Tk_GetHINSTANCE.3
+fi
+if test -r GetHWND.3; then
+ rm -f Tk_GetHWND.3
+ cp GetHWND.3 Tk_GetHWND.3
fi
if test -r GetImage.3; then
rm -f Tk_GetImage.3
+ rm -f Tk_RedrawImage.3
+ rm -f Tk_SizeOfImage.3
+ rm -f Tk_FreeImage.3
cp GetImage.3 Tk_GetImage.3
-fi
-if test -r CrtImgType.3; then
- rm -f Tk_GetImageMasterData.3
- cp CrtImgType.3 Tk_GetImageMasterData.3
-fi
-if test -r CrtItemType.3; then
- rm -f Tk_GetItemTypes.3
- cp CrtItemType.3 Tk_GetItemTypes.3
+ cp GetImage.3 Tk_RedrawImage.3
+ cp GetImage.3 Tk_SizeOfImage.3
+ cp GetImage.3 Tk_FreeImage.3
fi
if test -r GetJoinStl.3; then
rm -f Tk_GetJoinStyle.3
+ rm -f Tk_NameOfJoinStyle.3
cp GetJoinStl.3 Tk_GetJoinStyle.3
+ cp GetJoinStl.3 Tk_NameOfJoinStyle.3
fi
if test -r GetJustify.3; then
+ rm -f Tk_GetJustifyFromObj.3
rm -f Tk_GetJustify.3
+ rm -f Tk_NameOfJustify.3
+ cp GetJustify.3 Tk_GetJustifyFromObj.3
cp GetJustify.3 Tk_GetJustify.3
+ cp GetJustify.3 Tk_NameOfJustify.3
fi
if test -r GetOption.3; then
rm -f Tk_GetOption.3
cp GetOption.3 Tk_GetOption.3
fi
if test -r GetPixels.3; then
+ rm -f Tk_GetPixelsFromObj.3
rm -f Tk_GetPixels.3
+ rm -f Tk_GetMMFromObj.3
+ rm -f Tk_GetScreenMM.3
+ cp GetPixels.3 Tk_GetPixelsFromObj.3
cp GetPixels.3 Tk_GetPixels.3
+ cp GetPixels.3 Tk_GetMMFromObj.3
+ cp GetPixels.3 Tk_GetScreenMM.3
fi
if test -r GetPixmap.3; then
rm -f Tk_GetPixmap.3
+ rm -f Tk_FreePixmap.3
cp GetPixmap.3 Tk_GetPixmap.3
+ cp GetPixmap.3 Tk_FreePixmap.3
fi
if test -r GetRelief.3; then
+ rm -f Tk_GetReliefFromObj.3
rm -f Tk_GetRelief.3
+ rm -f Tk_NameOfRelief.3
+ cp GetRelief.3 Tk_GetReliefFromObj.3
cp GetRelief.3 Tk_GetRelief.3
+ cp GetRelief.3 Tk_NameOfRelief.3
fi
if test -r GetRootCrd.3; then
rm -f Tk_GetRootCoords.3
cp GetRootCrd.3 Tk_GetRootCoords.3
fi
-if test -r GetPixels.3; then
- rm -f Tk_GetScreenMM.3
- cp GetPixels.3 Tk_GetScreenMM.3
-fi
if test -r GetScroll.3; then
rm -f Tk_GetScrollInfo.3
+ rm -f Tk_GetScrollInfoObj.3
cp GetScroll.3 Tk_GetScrollInfo.3
+ cp GetScroll.3 Tk_GetScrollInfoObj.3
fi
if test -r GetSelect.3; then
rm -f Tk_GetSelection.3
@@ -473,7 +438,9 @@ if test -r GetSelect.3; then
fi
if test -r GetUid.3; then
rm -f Tk_GetUid.3
+ rm -f Tk_Uid.3
cp GetUid.3 Tk_GetUid.3
+ cp GetUid.3 Tk_Uid.3
fi
if test -r GetVRoot.3; then
rm -f Tk_GetVRootGeometry.3
@@ -483,14 +450,20 @@ if test -r GetVisual.3; then
rm -f Tk_GetVisual.3
cp GetVisual.3 Tk_GetVisual.3
fi
+if test -r Grab.3; then
+ rm -f Tk_Grab.3
+ rm -f Tk_Ungrab.3
+ cp Grab.3 Tk_Grab.3
+ cp Grab.3 Tk_Ungrab.3
+fi
+if test -r HWNDToWindow.3; then
+ rm -f Tk_HWNDToWindow.3
+ cp HWNDToWindow.3 Tk_HWNDToWindow.3
+fi
if test -r HandleEvent.3; then
rm -f Tk_HandleEvent.3
cp HandleEvent.3 Tk_HandleEvent.3
fi
-if test -r WindowId.3; then
- rm -f Tk_Height.3
- cp WindowId.3 Tk_Height.3
-fi
if test -r IdToWindow.3; then
rm -f Tk_IdToWindow.3
cp IdToWindow.3 Tk_IdToWindow.3
@@ -501,23 +474,9 @@ if test -r ImgChanged.3; then
fi
if test -r InternAtom.3; then
rm -f Tk_InternAtom.3
+ rm -f Tk_GetAtomName.3
cp InternAtom.3 Tk_InternAtom.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_InternalBorderWidth.3
- cp WindowId.3 Tk_InternalBorderWidth.3
-fi
-if test -r TextLayout.3; then
- rm -f Tk_IntersectTextLayout.3
- cp TextLayout.3 Tk_IntersectTextLayout.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_IsMapped.3
- cp WindowId.3 Tk_IsMapped.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_IsTopLevel.3
- cp WindowId.3 Tk_IsTopLevel.3
+ cp InternAtom.3 Tk_GetAtomName.3
fi
if test -r MainLoop.3; then
rm -f Tk_MainLoop.3
@@ -525,15 +484,15 @@ if test -r MainLoop.3; then
fi
if test -r MainWin.3; then
rm -f Tk_MainWindow.3
+ rm -f Tk_GetNumMainWindows.3
cp MainWin.3 Tk_MainWindow.3
+ cp MainWin.3 Tk_GetNumMainWindows.3
fi
if test -r MaintGeom.3; then
rm -f Tk_MaintainGeometry.3
+ rm -f Tk_UnmaintainGeometry.3
cp MaintGeom.3 Tk_MaintainGeometry.3
-fi
-if test -r CrtWindow.3; then
- rm -f Tk_MakeWindowExist.3
- cp CrtWindow.3 Tk_MakeWindowExist.3
+ cp MaintGeom.3 Tk_UnmaintainGeometry.3
fi
if test -r ManageGeom.3; then
rm -f Tk_ManageGeometry.3
@@ -541,152 +500,48 @@ if test -r ManageGeom.3; then
fi
if test -r MapWindow.3; then
rm -f Tk_MapWindow.3
+ rm -f Tk_UnmapWindow.3
cp MapWindow.3 Tk_MapWindow.3
+ cp MapWindow.3 Tk_UnmapWindow.3
fi
if test -r MeasureChar.3; then
rm -f Tk_MeasureChars.3
+ rm -f Tk_TextWidth.3
+ rm -f Tk_DrawChars.3
+ rm -f Tk_UnderlineChars.3
cp MeasureChar.3 Tk_MeasureChars.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_MoveResizeWindow.3
- cp ConfigWind.3 Tk_MoveResizeWindow.3
+ cp MeasureChar.3 Tk_TextWidth.3
+ cp MeasureChar.3 Tk_DrawChars.3
+ cp MeasureChar.3 Tk_UnderlineChars.3
fi
if test -r MoveToplev.3; then
rm -f Tk_MoveToplevelWindow.3
cp MoveToplev.3 Tk_MoveToplevelWindow.3
fi
-if test -r ConfigWind.3; then
- rm -f Tk_MoveWindow.3
- cp ConfigWind.3 Tk_MoveWindow.3
-fi
if test -r Name.3; then
rm -f Tk_Name.3
+ rm -f Tk_PathName.3
+ rm -f Tk_NameToWindow.3
cp Name.3 Tk_Name.3
-fi
-if test -r 3DBorder.3; then
- rm -f Tk_NameOf3DBorder.3
- cp 3DBorder.3 Tk_NameOf3DBorder.3
-fi
-if test -r GetAnchor.3; then
- rm -f Tk_NameOfAnchor.3
- cp GetAnchor.3 Tk_NameOfAnchor.3
-fi
-if test -r GetBitmap.3; then
- rm -f Tk_NameOfBitmap.3
- cp GetBitmap.3 Tk_NameOfBitmap.3
-fi
-if test -r GetCapStyl.3; then
- rm -f Tk_NameOfCapStyle.3
- cp GetCapStyl.3 Tk_NameOfCapStyle.3
-fi
-if test -r GetColor.3; then
- rm -f Tk_NameOfColor.3
- cp GetColor.3 Tk_NameOfColor.3
-fi
-if test -r GetCursor.3; then
- rm -f Tk_NameOfCursor.3
- cp GetCursor.3 Tk_NameOfCursor.3
-fi
-if test -r GetFont.3; then
- rm -f Tk_NameOfFont.3
- cp GetFont.3 Tk_NameOfFont.3
+ cp Name.3 Tk_PathName.3
+ cp Name.3 Tk_NameToWindow.3
fi
if test -r NameOfImg.3; then
rm -f Tk_NameOfImage.3
cp NameOfImg.3 Tk_NameOfImage.3
fi
-if test -r GetJoinStl.3; then
- rm -f Tk_NameOfJoinStyle.3
- cp GetJoinStl.3 Tk_NameOfJoinStyle.3
-fi
-if test -r GetJustify.3; then
- rm -f Tk_NameOfJustify.3
- cp GetJustify.3 Tk_NameOfJustify.3
-fi
-if test -r GetRelief.3; then
- rm -f Tk_NameOfRelief.3
- cp GetRelief.3 Tk_NameOfRelief.3
-fi
-if test -r Name.3; then
- rm -f Tk_NameToWindow.3
- cp Name.3 Tk_NameToWindow.3
-fi
-if test -r ConfigWidg.3; then
- rm -f Tk_Offset.3
- cp ConfigWidg.3 Tk_Offset.3
-fi
if test -r OwnSelect.3; then
rm -f Tk_OwnSelection.3
cp OwnSelect.3 Tk_OwnSelection.3
fi
-if test -r WindowId.3; then
- rm -f Tk_Parent.3
- cp WindowId.3 Tk_Parent.3
-fi
if test -r ParseArgv.3; then
rm -f Tk_ParseArgv.3
cp ParseArgv.3 Tk_ParseArgv.3
fi
-if test -r Name.3; then
- rm -f Tk_PathName.3
- cp Name.3 Tk_PathName.3
-fi
-if test -r FindPhoto.3; then
- rm -f Tk_PhotoBlank.3
- cp FindPhoto.3 Tk_PhotoBlank.3
-fi
-if test -r FindPhoto.3; then
- rm -f Tk_PhotoExpand.3
- cp FindPhoto.3 Tk_PhotoExpand.3
-fi
-if test -r FindPhoto.3; then
- rm -f Tk_PhotoGetImage.3
- cp FindPhoto.3 Tk_PhotoGetImage.3
-fi
-if test -r FindPhoto.3; then
- rm -f Tk_PhotoGetSize.3
- cp FindPhoto.3 Tk_PhotoGetSize.3
-fi
-if test -r FindPhoto.3; then
- rm -f Tk_PhotoPutBlock.3
- cp FindPhoto.3 Tk_PhotoPutBlock.3
-fi
-if test -r FindPhoto.3; then
- rm -f Tk_PhotoPutZoomedBlock.3
- cp FindPhoto.3 Tk_PhotoPutZoomedBlock.3
-fi
-if test -r FindPhoto.3; then
- rm -f Tk_PhotoSetSize.3
- cp FindPhoto.3 Tk_PhotoSetSize.3
-fi
-if test -r TextLayout.3; then
- rm -f Tk_PointToChar.3
- cp TextLayout.3 Tk_PointToChar.3
-fi
-if test -r FontId.3; then
- rm -f Tk_PostscriptFontName.3
- cp FontId.3 Tk_PostscriptFontName.3
-fi
if test -r QWinEvent.3; then
rm -f Tk_QueueWindowEvent.3
cp QWinEvent.3 Tk_QueueWindowEvent.3
fi
-if test -r GetImage.3; then
- rm -f Tk_RedrawImage.3
- cp GetImage.3 Tk_RedrawImage.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_ReqHeight.3
- cp WindowId.3 Tk_ReqHeight.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_ReqWidth.3
- cp WindowId.3 Tk_ReqWidth.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_ResizeWindow.3
- cp ConfigWind.3 Tk_ResizeWindow.3
-fi
if test -r Restack.3; then
rm -f Tk_RestackWindow.3
cp Restack.3 Tk_RestackWindow.3
@@ -695,169 +550,153 @@ if test -r RestrictEv.3; then
rm -f Tk_RestrictEvents.3
cp RestrictEv.3 Tk_RestrictEvents.3
fi
-if test -r WindowId.3; then
- rm -f Tk_Screen.3
- cp WindowId.3 Tk_Screen.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_ScreenNumber.3
- cp WindowId.3 Tk_ScreenNumber.3
-fi
if test -r SetAppName.3; then
rm -f Tk_SetAppName.3
cp SetAppName.3 Tk_SetAppName.3
fi
-if test -r 3DBorder.3; then
- rm -f Tk_SetBackgroundFromBorder.3
- cp 3DBorder.3 Tk_SetBackgroundFromBorder.3
-fi
if test -r SetClass.3; then
rm -f Tk_SetClass.3
+ rm -f Tk_Class.3
cp SetClass.3 Tk_SetClass.3
+ cp SetClass.3 Tk_Class.3
fi
if test -r SetGrid.3; then
rm -f Tk_SetGrid.3
+ rm -f Tk_UnsetGrid.3
cp SetGrid.3 Tk_SetGrid.3
+ cp SetGrid.3 Tk_UnsetGrid.3
fi
-if test -r GeomReq.3; then
- rm -f Tk_SetInternalBorder.3
- cp GeomReq.3 Tk_SetInternalBorder.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_SetWindowBackground.3
- cp ConfigWind.3 Tk_SetWindowBackground.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_SetWindowBackgroundPixmap.3
- cp ConfigWind.3 Tk_SetWindowBackgroundPixmap.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_SetWindowBorder.3
- cp ConfigWind.3 Tk_SetWindowBorder.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_SetWindowBorderPixmap.3
- cp ConfigWind.3 Tk_SetWindowBorderPixmap.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_SetWindowBorderWidth.3
- cp ConfigWind.3 Tk_SetWindowBorderWidth.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_SetWindowColormap.3
- cp ConfigWind.3 Tk_SetWindowColormap.3
+if test -r SetOptions.3; then
+ rm -f Tk_CreateOptionTable.3
+ rm -f Tk_DeleteOptionTable.3
+ rm -f Tk_InitOptions.3
+ rm -f Tk_SetOptions.3
+ rm -f Tk_FreeSavedOptions.3
+ rm -f Tk_RestoreSavedOptions.3
+ rm -f Tk_GetOptionValue.3
+ rm -f Tk_GetOptionInfo.3
+ rm -f Tk_FreeConfigOptions.3
+ rm -f Tk_Offset.3
+ cp SetOptions.3 Tk_CreateOptionTable.3
+ cp SetOptions.3 Tk_DeleteOptionTable.3
+ cp SetOptions.3 Tk_InitOptions.3
+ cp SetOptions.3 Tk_SetOptions.3
+ cp SetOptions.3 Tk_FreeSavedOptions.3
+ cp SetOptions.3 Tk_RestoreSavedOptions.3
+ cp SetOptions.3 Tk_GetOptionValue.3
+ cp SetOptions.3 Tk_GetOptionInfo.3
+ cp SetOptions.3 Tk_FreeConfigOptions.3
+ cp SetOptions.3 Tk_Offset.3
fi
if test -r SetVisual.3; then
rm -f Tk_SetWindowVisual.3
cp SetVisual.3 Tk_SetWindowVisual.3
fi
-if test -r GetBitmap.3; then
- rm -f Tk_SizeOfBitmap.3
- cp GetBitmap.3 Tk_SizeOfBitmap.3
-fi
-if test -r GetImage.3; then
- rm -f Tk_SizeOfImage.3
- cp GetImage.3 Tk_SizeOfImage.3
-fi
if test -r StrictMotif.3; then
rm -f Tk_StrictMotif.3
cp StrictMotif.3 Tk_StrictMotif.3
fi
if test -r TextLayout.3; then
- rm -f Tk_TextLayoutToPostscript.3
- cp TextLayout.3 Tk_TextLayoutToPostscript.3
-fi
-if test -r MeasureChar.3; then
- rm -f Tk_TextWidth.3
- cp MeasureChar.3 Tk_TextWidth.3
-fi
-if test -r GetUid.3; then
- rm -f Tk_Uid.3
- cp GetUid.3 Tk_Uid.3
-fi
-if test -r ConfigWind.3; then
- rm -f Tk_UndefineCursor.3
- cp ConfigWind.3 Tk_UndefineCursor.3
-fi
-if test -r MeasureChar.3; then
- rm -f Tk_UnderlineChars.3
- cp MeasureChar.3 Tk_UnderlineChars.3
-fi
-if test -r TextLayout.3; then
+ rm -f Tk_ComputeTextLayout.3
+ rm -f Tk_FreeTextLayout.3
+ rm -f Tk_DrawTextLayout.3
rm -f Tk_UnderlineTextLayout.3
+ rm -f Tk_PointToChar.3
+ rm -f Tk_CharBbox.3
+ rm -f Tk_DistanceToTextLayout.3
+ rm -f Tk_IntersectTextLayout.3
+ rm -f Tk_TextLayoutToPostscript.3
+ cp TextLayout.3 Tk_ComputeTextLayout.3
+ cp TextLayout.3 Tk_FreeTextLayout.3
+ cp TextLayout.3 Tk_DrawTextLayout.3
cp TextLayout.3 Tk_UnderlineTextLayout.3
+ cp TextLayout.3 Tk_PointToChar.3
+ cp TextLayout.3 Tk_CharBbox.3
+ cp TextLayout.3 Tk_DistanceToTextLayout.3
+ cp TextLayout.3 Tk_IntersectTextLayout.3
+ cp TextLayout.3 Tk_TextLayoutToPostscript.3
fi
-if test -r MaintGeom.3; then
- rm -f Tk_UnmaintainGeometry.3
- cp MaintGeom.3 Tk_UnmaintainGeometry.3
-fi
-if test -r MapWindow.3; then
- rm -f Tk_UnmapWindow.3
- cp MapWindow.3 Tk_UnmapWindow.3
-fi
-if test -r SetGrid.3; then
- rm -f Tk_UnsetGrid.3
- cp SetGrid.3 Tk_UnsetGrid.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_Visual.3
- cp WindowId.3 Tk_Visual.3
-fi
-if test -r WindowId.3; then
- rm -f Tk_Width.3
- cp WindowId.3 Tk_Width.3
+if test -r TkInitStubs.3; then
+ rm -f Tk_InitStubs.3
+ cp TkInitStubs.3 Tk_InitStubs.3
fi
if test -r WindowId.3; then
rm -f Tk_WindowId.3
- cp WindowId.3 Tk_WindowId.3
-fi
-if test -r WindowId.3; then
+ rm -f Tk_Parent.3
+ rm -f Tk_Display.3
+ rm -f Tk_DisplayName.3
+ rm -f Tk_ScreenNumber.3
+ rm -f Tk_Screen.3
rm -f Tk_X.3
- cp WindowId.3 Tk_X.3
-fi
-if test -r WindowId.3; then
rm -f Tk_Y.3
+ rm -f Tk_Width.3
+ rm -f Tk_Height.3
+ rm -f Tk_Changes.3
+ rm -f Tk_Attributes.3
+ rm -f Tk_IsContainer.3
+ rm -f Tk_IsEmbedded.3
+ rm -f Tk_IsMapped.3
+ rm -f Tk_IsTopLevel.3
+ rm -f Tk_ReqWidth.3
+ rm -f Tk_ReqHeight.3
+ rm -f Tk_InternalBorderWidth.3
+ rm -f Tk_Visual.3
+ rm -f Tk_Depth.3
+ rm -f Tk_Colormap.3
+ cp WindowId.3 Tk_WindowId.3
+ cp WindowId.3 Tk_Parent.3
+ cp WindowId.3 Tk_Display.3
+ cp WindowId.3 Tk_DisplayName.3
+ cp WindowId.3 Tk_ScreenNumber.3
+ cp WindowId.3 Tk_Screen.3
+ cp WindowId.3 Tk_X.3
cp WindowId.3 Tk_Y.3
-fi
-if test -r menubar.n; then
- rm -f tk_bindForTraversal.n
- cp menubar.n tk_bindForTraversal.n
-fi
-if test -r palette.n; then
- rm -f tk_bisque.n
- cp palette.n tk_bisque.n
+ cp WindowId.3 Tk_Width.3
+ cp WindowId.3 Tk_Height.3
+ cp WindowId.3 Tk_Changes.3
+ cp WindowId.3 Tk_Attributes.3
+ cp WindowId.3 Tk_IsContainer.3
+ cp WindowId.3 Tk_IsEmbedded.3
+ cp WindowId.3 Tk_IsMapped.3
+ cp WindowId.3 Tk_IsTopLevel.3
+ cp WindowId.3 Tk_ReqWidth.3
+ cp WindowId.3 Tk_ReqHeight.3
+ cp WindowId.3 Tk_InternalBorderWidth.3
+ cp WindowId.3 Tk_Visual.3
+ cp WindowId.3 Tk_Depth.3
+ cp WindowId.3 Tk_Colormap.3
fi
if test -r chooseColor.n; then
rm -f tk_chooseColor.n
cp chooseColor.n tk_chooseColor.n
fi
+if test -r chooseDirectory.n; then
+ rm -f tk_chooseDirectory.n
+ cp chooseDirectory.n tk_chooseDirectory.n
+fi
if test -r dialog.n; then
rm -f tk_dialog.n
cp dialog.n tk_dialog.n
fi
if test -r focusNext.n; then
- rm -f tk_focusFollowsMouse.n
- cp focusNext.n tk_focusFollowsMouse.n
-fi
-if test -r focusNext.n; then
rm -f tk_focusNext.n
- cp focusNext.n tk_focusNext.n
-fi
-if test -r focusNext.n; then
rm -f tk_focusPrev.n
+ rm -f tk_focusFollowsMouse.n
+ cp focusNext.n tk_focusNext.n
cp focusNext.n tk_focusPrev.n
+ cp focusNext.n tk_focusFollowsMouse.n
fi
if test -r getOpenFile.n; then
rm -f tk_getOpenFile.n
- cp getOpenFile.n tk_getOpenFile.n
-fi
-if test -r getOpenFile.n; then
rm -f tk_getSaveFile.n
+ cp getOpenFile.n tk_getOpenFile.n
cp getOpenFile.n tk_getSaveFile.n
fi
if test -r menubar.n; then
rm -f tk_menuBar.n
+ rm -f tk_bindForTraversal.n
cp menubar.n tk_menuBar.n
+ cp menubar.n tk_bindForTraversal.n
fi
if test -r messageBox.n; then
rm -f tk_messageBox.n
@@ -867,12 +706,14 @@ if test -r optionMenu.n; then
rm -f tk_optionMenu.n
cp optionMenu.n tk_optionMenu.n
fi
-if test -r popup.n; then
- rm -f tk_popup.n
- cp popup.n tk_popup.n
-fi
if test -r palette.n; then
rm -f tk_setPalette.n
+ rm -f tk_bisque.n
cp palette.n tk_setPalette.n
+ cp palette.n tk_bisque.n
+fi
+if test -r popup.n; then
+ rm -f tk_popup.n
+ cp popup.n tk_popup.n
fi
exit 0
diff --git a/tk/unix/porting.old b/tk/unix/porting.old
new file mode 100644
index 00000000000..ea8aa5c2cc0
--- /dev/null
+++ b/tk/unix/porting.old
@@ -0,0 +1,324 @@
+This is an old version of the file "porting.notes". It contains
+porting information that people submitted for Tk releases numbered
+3.6 and earlier. You may find information in this file useful if
+there is no information available for your machine in the current
+version of "porting.notes".
+
+I don't have personal access to any of these machines, so I make
+no guarantees that the notes are correct, complete, or up-to-date.
+If you see the word "I" in any explanations, it refers to the person
+who contributed the information, not to me; this means that I
+probably can't answer any questions about any of this stuff. In
+some cases, a person has volunteered to act as a contact point for
+questions about porting Tcl to a particular machine; in these
+cases the person's name and e-mail address are listed. I'd be
+happy to receive corrections or updates.
+
+sccsid = SCCS: @(#) porting.old 1.2 96/02/16 10:27:30
+
+---------------------------------------------
+DEC Alphas:
+---------------------------------------------
+
+1. There appears to be a compiler/library bug that prevents tkTrig.c
+from compiling unless you turn off optimization (remove the -O compiler
+switch). The problem appears to have been fixed in the 1.3-4 version
+of the compiler.
+
+---------------------------------------------
+HP-UX systems:
+---------------------------------------------
+
+1. Configuration:
+ HP-UX Release 7.05 on a series 300 (68k) machine.
+ The native cc has been used for production.
+ X11r4 libraries and include files were taken from
+ internet archives, where as the server came with HPUX release 7.05.
+
+ Problems:
+ Symbol table space for cc had to be increased with: -Wc,-Ns3000
+ tkBind.c did not compile under -O:
+ C1 internal error in "GetField": Set Error Detected
+ *** Error code 1
+ tkBind.c did compile without optimization (no -O).
+
+2. Note: if you have trouble getting xauth-style access control to work
+(and you'll need xauth if you want to use "send"), be sure to uncomment
+the line
+
+# Vuelogin*authorize: True
+
+in the file /usr/vue/config/Xconfig, so that the server starts up with
+authorization enabled. Also, you may have to reboot the machine in
+order to force the server to restart.
+
+---------------------------------------------
+SCO Unix:
+---------------------------------------------
+
+Getting Tk to run under SCO Unix:
+
+Add a "#undef select" to tkEvent.c, and remove the reference to TK_EXCEPTION
+around line 460 of main.c.
+
+Tk uses its own scheme for allocating the border colors for its 3D widgets,
+which causes problems when running TK on a system with "PseudoColor"
+display class, and a 16-cell colormap.
+
+If you can't go to eight bitplanes, you can instead start the server with a
+"-static" (Xsco) or "-analog" (Xsight) option, making the display class
+become "StaticColor". This makes the entire colormap read-only, and it will
+return the color that most closely maps to the desired color as possible.
+
+---------------------------------------------
+Silicon Graphics systems:
+---------------------------------------------
+
+1. Change the CC variable in the Makefile to:
+
+CC = cc -xansi -D__STDC__ -signed
+
+2. Change the LIBS variable in the Makefile to use the X11 shared library
+ ("-lX11_s" instead of "-lX11").
+
+3. Under some versions of IRIX (e.g. 4.0.1) you have to turn off
+ optimization (e.g. change "-O" in CFLAGS to "-O0" or remove it
+ entirely) because of faulty code generation. If the Tcl or Tk test
+ suites fail, turn off optimization.
+
+4. Add a "-lsun" switch just before "-lm" in the LIBS definition.
+ Under some versions of IRIX (5.1.1.3?) you'll need to omit the
+ "-lsun" switch, plus remove the "-lsocket" and "-lnsl" switches
+ added by the configure script; otherwise you won't be able to
+ use symbolic host names for the display, only numerical Internet
+ addresses.
+
+5. Rumor has it that you'll also need a "-lmalloc" switch in the
+ LIBS definition.
+
+6. In IRIX 5.2 you'll have to modify Makefile to fix the following problems:
+ - The "-c" option is illegal with this version of install, but
+ the "-F" switch is needed instead. Change this in the "INSTALL ="
+ definition line.
+ - The order of file and directory have to be changed in all the
+ invocations of INSTALL_DATA or INSTALL_PROGRAM.
+
+---------------------------------------------
+IBM RS/6000's:
+---------------------------------------------
+1. To allow ALT- sequences to work on the RS-6000, the following
+line should be changed in tkBind.c:
+
+ OLD LINE:
+ {"Alt", Mod2Mask, 0},
+ NEW LINE:
+ {"Alt", Mod1Mask, 0},
+
+---------------------------------------------
+AT&T SVR4:
+---------------------------------------------
+
+1. The first major hurdle is that SVR4's select() subtly differs
+from BSD select. This impacts Tk in two ways, some of the Xlib calls
+make use of select() and are inherently broken and Tk itself makes
+extensive use of select(). The first problem can't be fixed without
+rebuilding one's Xlib, but can be avoided. I intend to submit part
+of my work the XFree86 guys so that the next version of XFree86 for
+SVR4 will not be broken. Until then, it is necessary to comment out
+this section of code from Tk_DoOneEvent() (which is near line 1227):
+
+#if !defined(SVR4)
+ void (*oldHandler)();
+
+ oldHandler = (void (*)()) signal(SIGPIPE, SIG_IGN);
+ XNoOp(display);
+ XFlush(display);
+ (void) signal(SIGPIPE, oldHandler);
+#endif /* SVR4 */
+
+if you don't comment it out, some scripts cause wish to go into
+an infinite loop of sending no-ops to the X server.
+
+2. As for fixing Tk's calls to select(), I've taken the simple
+approach of writing a wrapper for select and then using #define to
+replace all calls to select with the wrapper. I chose tkConfig.h
+to load the wrapper. So at the very end of tkConfig.h, it now looks
+like:
+
+#if defined(SVR4)
+# include "BSDselect.h"
+#endif
+
+#endif /* _TKCONFIG */
+
+The file BSDselect.h looks like this:
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/select.h>
+
+/* This is a fix for the difference between BSD's select() and
+ * SVR4's select(). SVR4's select() can never return a value larger
+ * than the total number of file descriptors being checked. So, if
+ * you select for read and write on one file descriptor, and both
+ * are true, SVR4 select() will only return 1. BSD select in the
+ * same situation will return 2.
+ *
+ * Additionally, BSD select() on timing out, will zero the masks,
+ * while SVR4 does not. This is fixed here as well.
+ *
+ * Set your tabstops to 4 characters to have this code nicely formatted.
+ *
+ * Jerry Whelan, guru@bradley.edu, June 12th, 1993
+ */
+
+
+int
+BSDselect(nfds, readfds, writefds, exceptfds, timeout)
+int nfds;
+fd_set *readfds, *writefds, *exceptfds;
+struct timeval *timeout;
+{
+ int rval,
+ i;
+
+ rval = select(nfds, readfds, writefds, exceptfds, timeout);
+
+ switch(rval) {
+ case -1: return(rval);
+ break;
+
+ case 0: if(readfds != NULL)
+ FD_ZERO(readfds);
+ if(writefds != NULL)
+ FD_ZERO(writefds);
+ if(exceptfds != NULL)
+ FD_ZERO(exceptfds);
+
+ return(rval);
+ break;
+
+ default: for(i=0, rval=0; i < nfds; i++) {
+ if((readfds != NULL) && FD_ISSET
+(i, readfds)) rval++;
+ if((writefds != NULL) && FD_ISSE
+T(i, writefds)) rval++;
+ if((writefds != NULL) && FD_ISSE
+T(i, exceptfds)) rval++;
+ }
+ return(rval);
+ }
+/* Should never get here */
+}
+
+---------------------------------------------
+CDC 4680MP, EP/IX 1.4.3:
+---------------------------------------------
+
+The installation was done in the System V environment (-systype sysv)
+with the BSD extensions available (-I/usr/include/bsd and -lbsd). It was
+built with the 2.20 level C compiler. The 2.11 level can be used, but
+it is better to match what TCL is built with, which must be 2.20 or
+higher (see the porting notes with TCL for the details).
+
+To make the configure script find the BSD extensions, I set environment
+variable DEFS to "-I/usr/include/bsd" and LIBS to "-lbsd" before
+running it. I would have also set CC to "cc2.20", but that compiler
+driver has a bug that loader errors (e.g. not finding a library routine,
+which the script uses to tell what is available) do not cause an error
+status to be returned to the shell (but see the Tcl 2.1.1 porting notes
+for comments about using "-non_shared").
+
+After running configure, I changed the CC definition line in Makefile
+from:
+ CC=cc
+to
+ CC=cc2.20
+to match the TCL build. Skip this if the default compiler is already 2.20
+(or later).
+
+---------------------------------------------
+CDC 4680MP, EP/IX 2.1.1:
+---------------------------------------------
+
+The installation was done in the System V environment (-systype sysv)
+with the BSD extensions available (-I/usr/include/bsd and -lbsd). It was
+built with the 3.11 level C compiler. Earlier levels can be used, but it
+is better to match what TCL is built with, which must be 2.20 or higher
+(see the porting notes with TCL for the details).
+
+To make the configure script find the BSD extensions, I set environment
+variable DEFS to "-I/usr/include/bsd -non_shared" and LIBS to "-lbsd"
+before running it.
+
+See the Tcl porting notes for comments on why "-non_shared" is needed
+during the configuration step. It was removed from AC_FLAGS before
+building.
+
+-------------------------------------------------
+Pyramid, OSx 5.1a (UCB universe, GCC installed):
+-------------------------------------------------
+
+Instead of typing "./configure" to configure, type
+
+ DEFS="-I/usr/include/X11/attinc" ./configure
+
+to sh to do the configuration.
+
+-------------------------------------------------
+NextSTEP 3.1:
+-------------------------------------------------
+
+1. Run configure with predefined CPP:
+ CPP='cc -E' ./configure
+ (If your shell is [t]csh, do a "setenv CPP 'cc -E'")
+
+2. Edit Makefile:
+ -add the following to AC_FLAGS:
+ -Dstrtod=tcl_strtod
+
+Note: Tk's raise test may fail when running the tvtwm window manager.
+Changing to either twm or even better fvwm ensures that this test will
+succeed.
+
+-------------------------------------------------
+Encore 91, UMAX V 3.0.9.3:
+-------------------------------------------------
+
+1. Modify the CFLAGS definition in Makefile to include -DENCORE:
+
+ CFLAGS = -O -DENCORE
+
+2. "mkdir" does not by default create the parent directories. The mkdir
+directives should be modified to "midir -p".
+
+3. An error of a redeclaration of read, can be resolved by conditionally
+not compiling if an ENCORE system.
+
+#ifndef ENCORE
+extern int read _ANSI_ARGS_((int fd, char *buf, size_t size));
+#endif
+
+-------------------------------------------------
+Sequent machines running Dynix:
+Contact: Andrew Swan (aswan@soda.berkeley.edu)
+-------------------------------------------------
+
+1. Use gcc instead of the cc distributed by Sequent
+
+2. There are problems with the distributed version of
+ <stddef.h>. The easiest solution is probably to create a
+ copy of stddef.h, make sure it comes early in the include
+ path and then edit it as need be to eliminate conflicts
+ with the X11 header files.
+
+3. The same comments about the tanh function from the notes on
+ porting Tcl apply to Tk.
+
+-------------------------------------------------
+Systems running Interactive 4.0:
+-------------------------------------------------
+
+1. Add "-posix" to CFLAGS in Makefile (or Makefile.in).
+
+2. Add "-lnsl_s" to LIBS in Makefile (or Makefile.in).
diff --git a/tk/unix/tcl.m4 b/tk/unix/tcl.m4
new file mode 100644
index 00000000000..6ebd6a4b805
--- /dev/null
+++ b/tk/unix/tcl.m4
@@ -0,0 +1,1882 @@
+#------------------------------------------------------------------------
+# SC_PATH_TCLCONFIG --
+#
+# Locate the tclConfig.sh file and perform a sanity check on
+# the Tcl compile flags
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --with-tcl=...
+#
+# Defines the following vars:
+# TCL_BIN_DIR Full path to the directory containing
+# the tclConfig.sh file
+#------------------------------------------------------------------------
+
+AC_DEFUN(SC_PATH_TCLCONFIG, [
+ #
+ # Ok, lets find the tcl configuration
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-tcl
+ #
+
+ if test x"${no_tcl}" = x ; then
+ # we reset no_tcl in case something fails here
+ no_tcl=true
+ AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
+ AC_MSG_CHECKING([for Tcl configuration])
+ AC_CACHE_VAL(ac_cv_c_tclconfig,[
+
+ # First check to see if --with-tclconfig was specified.
+ if test x"${with_tclconfig}" != x ; then
+ if test -f "${with_tclconfig}/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
+ else
+ AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
+ fi
+ fi
+
+ # then check for a private Tcl installation
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in \
+ ../tcl \
+ `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../tcl \
+ `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../../tcl \
+ `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ if test -f "$i/win/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/win; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few common install locations
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` ; do
+ if test -f "$i/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+
+ # check in a few other private locations
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ for i in \
+ ${srcdir}/../tcl \
+ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ if test -f "$i/win/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/win; pwd)`
+ break
+ fi
+ done
+ fi
+ ])
+
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ TCL_BIN_DIR="# no Tcl configs found"
+ AC_MSG_ERROR(Can't find Tcl configuration definitions)
+ exit 0
+ else
+ no_tcl=
+ TCL_BIN_DIR=${ac_cv_c_tclconfig}
+ AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
+ fi
+ fi
+])
+
+#------------------------------------------------------------------------
+# SC_PATH_TKCONFIG --
+#
+# Locate the tkConfig.sh file
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --with-tk=...
+#
+# Defines the following vars:
+# TK_BIN_DIR Full path to the directory containing
+# the tkConfig.sh file
+#------------------------------------------------------------------------
+
+AC_DEFUN(SC_PATH_TKCONFIG, [
+ #
+ # Ok, lets find the tk configuration
+ # First, look for one uninstalled.
+ # the alternative search directory is invoked by --with-tk
+ #
+
+ if test x"${no_tk}" = x ; then
+ # we reset no_tk in case something fails here
+ no_tk=true
+ AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
+ AC_MSG_CHECKING([for Tk configuration])
+ AC_CACHE_VAL(ac_cv_c_tkconfig,[
+
+ # First check to see if --with-tkconfig was specified.
+ if test x"${with_tkconfig}" != x ; then
+ if test -f "${with_tkconfig}/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
+ else
+ AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
+ fi
+ fi
+
+ # then check for a private Tk library
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ for i in \
+ ../tk \
+ `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../tk \
+ `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
+ ../../../tk \
+ `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ if test -f "$i/win/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/win; pwd)`
+ break
+ fi
+ done
+ fi
+ # check in a few common install locations
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ for i in `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` ; do
+ if test -f "$i/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i; pwd)`
+ break
+ fi
+ done
+ fi
+ # check in a few other private locations
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ for i in \
+ ${srcdir}/../tk \
+ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
+ break
+ fi
+ if test -f "$i/win/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/win; pwd)`
+ break
+ fi
+ done
+ fi
+ ])
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ TK_BIN_DIR="# no Tk configs found"
+ AC_MSG_ERROR(Can't find Tk configuration definitions)
+ exit 0
+ else
+ no_tk=
+ TK_BIN_DIR=${ac_cv_c_tkconfig}
+ AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh)
+ fi
+ fi
+
+])
+
+#------------------------------------------------------------------------
+# SC_LOAD_TCLCONFIG --
+#
+# Load the tclConfig.sh file
+#
+# Arguments:
+#
+# Requires the following vars to be set:
+# TCL_BIN_DIR
+#
+# Results:
+#
+# Subst the following vars:
+# TCL_BIN_DIR
+# TCL_SRC_DIR
+# TCL_LIB_FILE
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN(SC_LOAD_TCLCONFIG, [
+ AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
+
+ if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
+ AC_MSG_RESULT([loading])
+ . $TCL_BIN_DIR/tclConfig.sh
+ else
+ AC_MSG_RESULT([file not found])
+ fi
+
+ #
+ # The eval is required to do the TCL_DBGX substitution in the
+ # TCL_LIB_FILE variable
+ #
+
+ eval TCL_LIB_FILE=${TCL_LIB_FILE}
+ eval TCL_LIB_FLAG=${TCL_LIB_FLAG}
+
+ AC_SUBST(TCL_BIN_DIR)
+ AC_SUBST(TCL_SRC_DIR)
+ AC_SUBST(TCL_LIB_FILE)
+])
+
+#------------------------------------------------------------------------
+# SC_LOAD_TKCONFIG --
+#
+# Load the tkConfig.sh file
+#
+# Arguments:
+#
+# Requires the following vars to be set:
+# TK_BIN_DIR
+#
+# Results:
+#
+# Sets the following vars that should be in tkConfig.sh:
+# TK_BIN_DIR
+#------------------------------------------------------------------------
+
+AC_DEFUN(SC_LOAD_TKCONFIG, [
+ AC_MSG_CHECKING([for existence of $TCLCONFIG])
+
+ if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
+ AC_MSG_CHECKING([loading $TK_BIN_DIR/tkConfig.sh])
+ . $TK_BIN_DIR/tkConfig.sh
+ else
+ AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
+ fi
+
+ AC_SUBST(TK_BIN_DIR)
+ AC_SUBST(TK_SRC_DIR)
+ AC_SUBST(TK_LIB_FILE)
+])
+
+#------------------------------------------------------------------------
+# SC_ENABLE_SHARED --
+#
+# Allows the building of shared libraries
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-shared=yes|no
+#
+# Defines the following vars:
+# STATIC_BUILD Used for building import/export libraries
+# on Windows.
+#
+# Sets the following vars:
+# SHARED_BUILD Value of 1 or 0
+#------------------------------------------------------------------------
+
+AC_DEFUN(SC_ENABLE_SHARED, [
+ AC_MSG_CHECKING([how to build libraries])
+ AC_ARG_ENABLE(shared,
+ [ --enable-shared build and link with shared libraries [--enable-shared]],
+ [tcl_ok=$enableval], [tcl_ok=no])
+
+ if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ tcl_ok=$enableval
+ else
+ tcl_ok=no
+ fi
+
+ if test "$tcl_ok" = "yes" ; then
+ AC_MSG_RESULT([shared])
+ SHARED_BUILD=1
+ else
+ AC_MSG_RESULT([static])
+ SHARED_BUILD=0
+ AC_DEFINE(STATIC_BUILD)
+ fi
+])
+
+#------------------------------------------------------------------------
+# SC_ENABLE_THREADS --
+#
+# Specify if thread support should be enabled
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-threads
+#
+# Sets the following vars:
+# THREADS_LIBS Thread library(s)
+#
+# Defines the following vars:
+# TCL_THREADS
+# _REENTRANT
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN(SC_ENABLE_THREADS, [
+ AC_MSG_CHECKING(for building with threads)
+ AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
+ [tcl_ok=$enableval], [tcl_ok=no])
+
+ if test "$tcl_ok" = "yes"; then
+ AC_MSG_RESULT(yes)
+ TCL_THREADS=1
+ AC_DEFINE(TCL_THREADS)
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_THREAD_SAFE)
+ AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
+ if test "$tcl_ok" = "no"; then
+ # Check a little harder for __pthread_mutex_init in the same
+ # library, as some systems hide it there until pthread.h is
+ # defined. We could alternatively do an AC_TRY_COMPILE with
+ # pthread.h, but that will work with libpthread really doesn't
+ # exist, like AIX 4.2. [Bug: 4359]
+ AC_CHECK_LIB(pthread,__pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
+ fi
+
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthread"
+ else
+ AC_CHECK_LIB(pthreads,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthreads"
+ else
+ AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
+ if test "$tcl_ok" = "no"; then
+ TCL_THREADS=0
+ AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...")
+ fi
+ fi
+ fi
+
+ # Does the pthread-implementation provide
+ # 'pthread_attr_setstacksize' ?
+
+ AC_CHECK_FUNCS(pthread_attr_setstacksize)
+ else
+ TCL_THREADS=0
+ AC_MSG_RESULT(no (default))
+ fi
+])
+
+#------------------------------------------------------------------------
+# SC_ENABLE_SYMBOLS --
+#
+# Specify if debugging symbols should be used
+#
+# Arguments:
+# none
+#
+# Requires the following vars to be set in the Makefile:
+# CFLAGS_DEBUG
+# CFLAGS_OPTIMIZE
+# LDFLAGS_DEBUG
+# LDFLAGS_OPTIMIZE
+#
+# Results:
+#
+# Adds the following arguments to configure:
+# --enable-symbols
+#
+# Defines the following vars:
+# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
+# Sets to $(CFLAGS_OPTIMIZE) if false
+# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
+# Sets to $(LDFLAGS_OPTIMIZE) if false
+# DBGX Debug library extension
+#
+#------------------------------------------------------------------------
+
+AC_DEFUN(SC_ENABLE_SYMBOLS, [
+ AC_MSG_CHECKING([for build with symbols])
+ AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
+ if test "$tcl_ok" = "yes"; then
+ CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
+ LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
+ DBGX=g
+ AC_MSG_RESULT([yes])
+ else
+ CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
+ LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
+ DBGX=""
+ AC_MSG_RESULT([no])
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_CONFIG_CFLAGS
+#
+# Try to determine the proper flags to pass to the compiler
+# for building shared libraries and other such nonsense.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines the following vars:
+#
+# DL_OBJS - Name of the object file that implements dynamic
+# loading for Tcl on this system.
+# DL_LIBS - Library file(s) to include in tclsh and other base
+# applications in order for the "load" command to work.
+# LDFLAGS - Flags to pass to the compiler when linking object
+# files into an executable application binary such
+# as tclsh.
+# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
+# that tell the run-time dynamic linker where to look
+# for shared libraries such as libtcl.so. Depends on
+# the variable LIB_RUNTIME_DIR in the Makefile.
+# MAKE_LIB - Command to execute to build the Tcl library;
+# differs depending on whether or not Tcl is being
+# compiled as a shared library.
+# STLIB_LD - Base command to use for combining object files
+# into a static library.
+# SHLIB_CFLAGS - Flags to pass to cc when compiling the components
+# of a shared library (may request position-independent
+# code, among other things).
+# SHLIB_LD - Base command to use for combining object files
+# into a shared library.
+# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
+# creating shared libraries. This symbol typically
+# goes at the end of the "ld" commands that build
+# shared libraries. The value of the symbol is
+# "${LIBS}" if all of the dependent libraries should
+# be specified when creating a shared library. If
+# dependent libraries should not be specified (as on
+# SunOS 4.x, where they cause the link to fail, or in
+# general if Tcl and Tk aren't themselves shared
+# libraries), then this symbol has an empty string
+# as its value.
+# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
+# extensions. An empty string means we don't know how
+# to use shared libraries on this platform.
+# TCL_LIB_FILE - Name of the file that contains the Tcl library, such
+# as libtcl7.8.so or libtcl7.8.a.
+# TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl"
+# in the shared library name, using the $VERSION variable
+# to put the version in the right place. This is used
+# by platforms that need non-standard library names.
+# Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
+# to have a version after the .so, and ${VERSION}.a
+# on AIX, since the Tcl shared library needs to have
+# a .a extension whereas shared objects for loadable
+# extensions have a .so extension. Defaults to
+# ${VERSION}${SHLIB_SUFFIX}.
+# TCL_NEEDS_EXP_FILE -
+# 1 means that an export file is needed to link to a
+# shared library.
+# TCL_EXP_FILE - The name of the installed export / import file which
+# should be used to link to the Tcl shared library.
+# Empty if Tcl is unshared.
+# TCL_BUILD_EXP_FILE -
+# The name of the built export / import file which
+# should be used to link to the Tcl shared library.
+# Empty if Tcl is unshared.
+# CFLAGS_DEBUG -
+# Flags used when running the compiler in debug mode
+# CFLAGS_OPTIMIZE -
+# Flags used when running the compiler in optimize mode
+#
+# EXTRA_CFLAGS
+#
+# Subst's the following vars:
+# DL_LIBS
+# CFLAGS_DEBUG
+# CFLAGS_OPTIMIZE
+#--------------------------------------------------------------------
+
+AC_DEFUN(SC_CONFIG_CFLAGS, [
+
+ # Step 0.a: Enable 64 bit support?
+
+ AC_MSG_CHECKING([if 64bit support is requested])
+ AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],,enableval="no")
+
+ if test "$enableval" = "yes"; then
+ do64bit=yes
+ else
+ do64bit=no
+ fi
+ AC_MSG_RESULT($do64bit)
+
+ # Step 0.b: Enable Solaris 64 bit VIS support?
+
+ AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
+ AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],,enableval="no")
+
+ if test "$enableval" = "yes"; then
+ # Force 64bit on with VIS
+ do64bit=yes
+ do64bitVIS=yes
+ else
+ do64bitVIS=no
+ fi
+ AC_MSG_RESULT($do64bitVIS)
+
+ # Step 1: set the variable "system" to hold the name and version number
+ # for the system. This can usually be done via the "uname" command, but
+ # there are a few systems, like Next, where this doesn't work.
+
+ AC_MSG_CHECKING([system version (for dynamic loading)])
+ if test -f /usr/lib/NextStep/software_version; then
+ system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+ else
+ system=`uname -s`-`uname -r`
+ if test "$?" -ne 0 ; then
+ AC_MSG_RESULT([unknown (can't find uname command)])
+ system=unknown
+ else
+ # Special check for weird MP-RAS system (uname returns weird
+ # results, and the version is kept in special file).
+
+ if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+ system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+ fi
+ if test "`uname -s`" = "AIX" ; then
+ system=AIX-`uname -v`.`uname -r`
+ fi
+ AC_MSG_RESULT($system)
+ fi
+ fi
+
+ AC_MSG_CHECKING([if gcc is being used])
+ if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
+ using_gcc="yes"
+ else
+ using_gcc="no"
+ fi
+
+ AC_MSG_RESULT([$using_gcc ($CC)])
+
+ # Step 2: check for existence of -ldl library. This is needed because
+ # Linux can use either -ldl or -ldld for dynamic loading.
+
+ AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
+
+ # Step 3: set configuration options based on system name and version.
+
+ do64bit_ok=no
+ fullSrcDir=`cd $srcdir; pwd`
+ EXTRA_CFLAGS=""
+ TCL_EXPORT_FILE_SUFFIX=""
+ UNSHARED_LIB_SUFFIX=""
+ TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
+ ECHO_VERSION='`echo ${VERSION}`'
+ TCL_LIB_VERSIONS_OK=ok
+ CFLAGS_DEBUG=-g
+ CFLAGS_OPTIMIZE=-O
+ if test "$using_gcc" = "yes" ; then
+ CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
+ else
+ CFLAGS_WARNING=""
+ fi
+ TCL_NEEDS_EXP_FILE=0
+ TCL_BUILD_EXP_FILE=""
+ TCL_EXP_FILE=""
+dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
+dnl AC_CHECK_TOOL(AR, ar, :)
+ AC_CHECK_PROG(AR, ar, ar)
+ STLIB_LD='${AR} cr'
+ case $system in
+ AIX-4.[[2-9]])
+ if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then
+ # AIX requires the _r compiler when gcc isn't being used
+ if test "${CC}" != "cc_r" ; then
+ CC=${CC}_r
+ fi
+ AC_MSG_RESULT(Using $CC for compiling with threads)
+ fi
+ SHLIB_CFLAGS=""
+ SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ TCL_NEEDS_EXP_FILE=1
+ TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
+ ;;
+ AIX-*)
+ if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then
+ # AIX requires the _r compiler when gcc isn't being used
+ if test "${CC}" != "cc_r" ; then
+ CC=${CC}_r
+ fi
+ AC_MSG_RESULT(Using $CC for compiling with threads)
+ fi
+ SHLIB_CFLAGS=""
+ SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ LIBOBJS="$LIBOBJS tclLoadAix.o"
+ DL_LIBS="-lld"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ TCL_NEEDS_EXP_FILE=1
+ TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
+ ;;
+ BSD/OS-2.1*|BSD/OS-3*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="shlicc -r"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ BSD/OS-4.*)
+ SHLIB_CFLAGS="-export-dynamic -fPIC"
+ SHLIB_LD="cc -shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="-export-dynamic"
+ LD_SEARCH_FLAGS=""
+ ;;
+ dgux*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*)
+ SHLIB_SUFFIX=".sl"
+ AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
+ if test "$tcl_ok" = yes; then
+ SHLIB_CFLAGS="+z"
+ SHLIB_LD="ld -b"
+ SHLIB_LD_LIBS=""
+ DL_OBJS="tclLoadShl.o"
+ DL_LIBS="-ldld"
+ LDFLAGS="-Wl,-E"
+ LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
+ fi
+ ;;
+ IRIX-4.*)
+ SHLIB_CFLAGS="-G 0"
+ SHLIB_SUFFIX=".a"
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ SHLIB_LD_LIBS='${LIBS}'
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS="-Wl,-D,08000000"
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
+ ;;
+ IRIX-5.*|IRIX-6.*|IRIX64-6.5*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -n32 -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ if test "$using_gcc" = "yes" ; then
+ EXTRA_CFLAGS="-mabi=n32"
+ LDFLAGS="-mabi=n32"
+ else
+ case $system in
+ IRIX-6.3)
+ # Use to build 6.2 compatible binaries on 6.3.
+ EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS"
+ ;;
+ *)
+ EXTRA_CFLAGS="-n32"
+ ;;
+ esac
+ LDFLAGS="-n32"
+ fi
+ ;;
+ IRIX64-6.*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="ld -32 -shared -rdata_shared"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ ;;
+ Linux*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+ # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
+ # when you inline the string and math operations. Turn this off to
+ # get rid of the warnings.
+
+ CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+
+ if test "$have_dl" = yes; then
+ SHLIB_LD="${CC} -shared"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="-rdynamic"
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ else
+ AC_CHECK_HEADER(dld.h, [
+ SHLIB_LD="ld -shared"
+ DL_OBJS="tclLoadDld.o"
+ DL_LIBS="-ldld"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""])
+ fi
+ if test "`uname -m`" = "alpha" ; then
+ EXTRA_CFLAGS="-mieee"
+ fi
+ ;;
+ MP-RAS-02*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ MP-RAS-*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="-Wl,-Bexport"
+ LD_SEARCH_FLAGS=""
+ ;;
+ NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*)
+ # Not available on all versions: check for include file.
+ AC_CHECK_HEADER(dlfcn.h, [
+ # NetBSD/SPARC needs -fPIC, -fpic will not do.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ AC_MSG_CHECKING(for ELF)
+ AC_EGREP_CPP(yes, [
+#ifdef __ELF__
+ yes
+#endif
+ ],
+ AC_MSG_RESULT(yes)
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so',
+ AC_MSG_RESULT(no)
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
+ )
+ ], [
+ SHLIB_CFLAGS=""
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".a"
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ ])
+
+ # FreeBSD doesn't handle version numbers with dots.
+
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ FreeBSD-*)
+ # FreeBSD 3.* and greater have ELF.
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -Bshareable -x"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS="-export-dynamic"
+ LD_SEARCH_FLAGS=""
+ ;;
+ NEXTSTEP-*)
+ SHLIB_CFLAGS=""
+ SHLIB_LD="cc -nostdlib -r"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadNext.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OS/390-*)
+ CFLAGS_OPTIMIZE="" # Optimizer is buggy
+ AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
+ ;;
+ OSF1-1.0|OSF1-1.1|OSF1-1.2)
+ # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
+ SHLIB_CFLAGS=""
+ # Hack: make package name same as library name
+ SHLIB_LD='ld -R -export $@:'
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadOSF.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OSF1-1.*)
+ # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="ld -shared"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ OSF1-V*)
+ # Digital OSF/1
+ SHLIB_CFLAGS=""
+ SHLIB_LD='ld -shared -expect_unresolved "*"'
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ if test "$using_gcc" = "no" ; then
+ EXTRA_CFLAGS="-DHAVE_TZSET -std1"
+ fi
+ # see pthread_intro(3) for pthread support on osf1, k.furukawa
+ if test "${TCL_THREADS}" = "1" ; then
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
+ if test "$using_gcc" = "no" ; then
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread"
+ LDFLAGS="-pthread"
+ else
+ LIBS=`echo $LIBS | sed s/-lpthreads//`
+ LIBS="$LIBS -lpthread -lmach -lexc"
+ fi
+ fi
+
+ ;;
+ RISCos-*)
+ SHLIB_CFLAGS="-G 0"
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".a"
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS="-Wl,-D,08000000"
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ ;;
+ SCO_SV-3.2*)
+ # Note, dlopen is available only on SCO 3.2.5 and greater. However,
+ # this test works, since "uname -s" was non-standard in 3.2.4 and
+ # below.
+ if test "$using_gcc" = "yes" ; then
+ SHLIB_CFLAGS="-fPIC -melf"
+ LDFLAGS="-melf -Wl,-Bexport"
+ else
+ SHLIB_CFLAGS="-Kpic -belf"
+ LDFLAGS="-belf -Wl,-Bexport"
+ fi
+ SHLIB_LD="ld -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS=""
+ LDFLAGS="-belf -Wl,-Bexport"
+ LD_SEARCH_FLAGS=""
+ ;;
+ SINIX*5.4*)
+ SHLIB_CFLAGS="-K PIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ ;;
+ SunOS-4*)
+ SHLIB_CFLAGS="-PIC"
+ SHLIB_LD="ld"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+
+ # SunOS can't handle version numbers with dots in them in library
+ # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
+ # requires an extra version number at the end of .so file names.
+ # So, the library has to have a name like libtcl75.so.1.0
+
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ TCL_LIB_VERSIONS_OK=nodots
+ ;;
+ SunOS-5.[[0-6]]*)
+ SHLIB_CFLAGS="-KPIC"
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS=""
+ LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ ;;
+ SunOS-5*)
+ SHLIB_CFLAGS="-KPIC"
+ SHLIB_LD="/usr/ccs/bin/ld -G -z text"
+ LDFLAGS=""
+
+ do64bit_ok=no
+ if test "$do64bit" = "yes" ; then
+ arch=`isainfo`
+ if test "$arch" = "sparcv9 sparc" ; then
+ if test "$using_gcc" = "no" ; then
+ do64bit_ok=yes
+ if test "$do64bitVIS" = "yes" ; then
+ EXTRA_CFLAGS="-xarch=v9a"
+ LDFLAGS="-xarch=v9a"
+ else
+ EXTRA_CFLAGS="-xarch=v9"
+ LDFLAGS="-xarch=v9"
+ fi
+ else
+ AC_MSG_WARN("64bit mode not supported with GCC on $system")
+ fi
+ else
+ AC_MSG_WARN("64bit mode only supported sparcv9 system")
+ fi
+ fi
+
+ # Note: need the LIBS below, otherwise Tk won't find Tcl's
+ # symbols when dynamically loaded into tclsh.
+
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ if test "$using_gcc" = "yes" ; then
+ LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+ else
+ LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
+ fi
+ ;;
+ ULTRIX-4.*)
+ SHLIB_CFLAGS="-G 0"
+ SHLIB_SUFFIX=".a"
+ SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
+ SHLIB_LD_LIBS='${LIBS}'
+ DL_OBJS="tclLoadAout.o"
+ DL_LIBS=""
+ LDFLAGS="-Wl,-D,08000000"
+ LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
+ if test "$using_gcc" = "no" ; then
+ EXTRA_CFLAGS="-DHAVE_TZSET -std1"
+ fi
+ ;;
+ UNIX_SV* | UnixWare-5*)
+ SHLIB_CFLAGS="-KPIC"
+ SHLIB_LD="cc -G"
+ SHLIB_LD_LIBS=""
+ SHLIB_SUFFIX=".so"
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
+ # that don't grok the -Bexport option. Test that it does.
+ hold_ldflags=$LDFLAGS
+ AC_MSG_CHECKING(for ld accepts -Bexport flag)
+ LDFLAGS="${LDFLAGS} -Wl,-Bexport"
+ AC_TRY_LINK(, [int i;], found=yes, found=no)
+ LDFLAGS=$hold_ldflags
+ AC_MSG_RESULT($found)
+ if test $found = yes; then
+ LDFLAGS="-Wl,-Bexport"
+ else
+ LDFLAGS=""
+ fi
+ LD_SEARCH_FLAGS=""
+ ;;
+ esac
+
+ if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
+ AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform")
+ fi
+
+ # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
+ # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
+ # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
+ # to determine which of several header files defines the a.out file
+ # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
+ # support only a file format that is more or less version-7-compatible.
+ # In particular,
+ # - a.out files must begin with `struct exec'.
+ # - the N_TXTOFF on the `struct exec' must compute the seek address
+ # of the text segment
+ # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
+ # and a_entry fields.
+ # The following compilation should succeed if and only if either sys/exec.h
+ # or a.out.h is usable for the purpose.
+ #
+ # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
+ # `struct exec' includes a second header that contains information that
+ # duplicates the v7 fields that are needed.
+
+ if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
+ AC_MSG_CHECKING(sys/exec.h)
+ AC_TRY_COMPILE([#include <sys/exec.h>],[
+ struct exec foo;
+ unsigned long seek;
+ int flag;
+#if defined(__mips) || defined(mips)
+ seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+#else
+ seek = N_TXTOFF (foo);
+#endif
+ flag = (foo.a_magic == OMAGIC);
+ return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+ ], tcl_ok=usable, tcl_ok=unusable)
+ AC_MSG_RESULT($tcl_ok)
+ if test $tcl_ok = usable; then
+ AC_DEFINE(USE_SYS_EXEC_H)
+ else
+ AC_MSG_CHECKING(a.out.h)
+ AC_TRY_COMPILE([#include <a.out.h>],[
+ struct exec foo;
+ unsigned long seek;
+ int flag;
+#if defined(__mips) || defined(mips)
+ seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+#else
+ seek = N_TXTOFF (foo);
+#endif
+ flag = (foo.a_magic == OMAGIC);
+ return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+ ], tcl_ok=usable, tcl_ok=unusable)
+ AC_MSG_RESULT($tcl_ok)
+ if test $tcl_ok = usable; then
+ AC_DEFINE(USE_A_OUT_H)
+ else
+ AC_MSG_CHECKING(sys/exec_aout.h)
+ AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
+ struct exec foo;
+ unsigned long seek;
+ int flag;
+#if defined(__mips) || defined(mips)
+ seek = N_TXTOFF (foo.ex_f, foo.ex_o);
+#else
+ seek = N_TXTOFF (foo);
+#endif
+ flag = (foo.a_midmag == OMAGIC);
+ return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
+ ], tcl_ok=usable, tcl_ok=unusable)
+ AC_MSG_RESULT($tcl_ok)
+ if test $tcl_ok = usable; then
+ AC_DEFINE(USE_SYS_EXEC_AOUT_H)
+ else
+ DL_OBJS=""
+ fi
+ fi
+ fi
+ fi
+
+ # Step 5: disable dynamic loading if requested via a command-line switch.
+
+ AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
+ [tcl_ok=$enableval], [tcl_ok=yes])
+ if test "$tcl_ok" = "no"; then
+ DL_OBJS=""
+ fi
+
+ if test "x$DL_OBJS" != "x" ; then
+ BUILD_DLTEST="\$(DLTEST_TARGETS)"
+ else
+ echo "Can't figure out how to do dynamic loading or shared libraries"
+ echo "on this system."
+ SHLIB_CFLAGS=""
+ SHLIB_LD=""
+ SHLIB_SUFFIX=""
+ DL_OBJS="tclLoadNone.o"
+ DL_LIBS=""
+ LDFLAGS=""
+ LD_SEARCH_FLAGS=""
+ BUILD_DLTEST=""
+ fi
+
+ # If we're running gcc, then change the C flags for compiling shared
+ # libraries to the right flags for gcc, instead of those for the
+ # standard manufacturer compiler.
+
+ if test "$DL_OBJS" != "tclLoadNone.o" ; then
+ if test "$using_gcc" = "yes" ; then
+ case $system in
+ AIX-*)
+ ;;
+ BSD/OS*)
+ ;;
+ IRIX*)
+ ;;
+ NetBSD-*|FreeBSD-*|OpenBSD-*)
+ ;;
+ RISCos-*)
+ ;;
+ SCO_SV-3.2*)
+ ;;
+ ULTRIX-4.*)
+ ;;
+ *)
+ SHLIB_CFLAGS="-fPIC"
+ ;;
+ esac
+ fi
+ fi
+
+ if test "$SHARED_LIB_SUFFIX" = "" ; then
+ SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
+ fi
+ if test "$UNSHARED_LIB_SUFFIX" = "" ; then
+ UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
+ fi
+
+# CYGNUS LOCAL
+ TCL_LIB_SUFFIX=.a
+ AC_SUBST(TCL_LIB_SUFFIX)
+# END CYGNUS LOCAL
+
+ AC_SUBST(DL_LIBS)
+ AC_SUBST(CFLAGS_DEBUG)
+ AC_SUBST(CFLAGS_OPTIMIZE)
+ AC_SUBST(CFLAGS_WARNING)
+])
+
+#--------------------------------------------------------------------
+# SC_SERIAL_PORT
+#
+# Determine which interface to use to talk to the serial port.
+# Note that #include lines must begin in leftmost column for
+# some compilers to recognize them as preprocessor directives.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines only one of the following vars:
+# USE_TERMIOS
+# USE_TERMIO
+# USE_SGTTY
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN(SC_SERIAL_PORT, [
+ AC_MSG_CHECKING([termios vs. termio vs. sgtty])
+
+ AC_TRY_RUN([
+#include <termios.h>
+
+main()
+{
+ struct termios t;
+ if (tcgetattr(0, &t) == 0) {
+ cfsetospeed(&t, 0);
+ t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
+ return 0;
+ }
+ return 1;
+}], tk_ok=termios, tk_ok=no, tk_ok=no)
+
+ if test $tk_ok = termios; then
+ AC_DEFINE(USE_TERMIOS)
+ else
+ AC_TRY_RUN([
+#include <termio.h>
+
+main()
+{
+ struct termio t;
+ if (ioctl(0, TCGETA, &t) == 0) {
+ t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
+ return 0;
+ }
+ return 1;
+ }], tk_ok=termio, tk_ok=no, tk_ok=no)
+
+ if test $tk_ok = termio; then
+ AC_DEFINE(USE_TERMIO)
+ else
+ AC_TRY_RUN([
+#include <sgtty.h>
+
+main()
+{
+ struct sgttyb t;
+ if (ioctl(0, TIOCGETP, &t) == 0) {
+ t.sg_ospeed = 0;
+ t.sg_flags |= ODDP | EVENP | RAW;
+ return 0;
+ }
+ return 1;
+}], tk_ok=sgtty, tk_ok=none, tk_ok=none)
+ if test $tk_ok = sgtty; then
+ AC_DEFINE(USE_SGTTY)
+ fi
+ fi
+ fi
+ AC_MSG_RESULT($tk_ok)
+])
+
+#--------------------------------------------------------------------
+# SC_MISSING_POSIX_HEADERS
+#
+# Supply substitutes for missing POSIX header files. Special
+# notes:
+# - stdlib.h doesn't define strtol, strtoul, or
+# strtod insome versions of SunOS
+# - some versions of string.h don't declare procedures such
+# as strstr
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines some of the following vars:
+# NO_DIRENT_H
+# NO_ERRNO_H
+# NO_VALUES_H
+# NO_LIMITS_H
+# NO_STDLIB_H
+# NO_STRING_H
+# NO_SYS_WAIT_H
+# NO_DLFCN_H
+# HAVE_UNISTD_H
+# HAVE_SYS_PARAM_H
+#
+# HAVE_STRING_H ?
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN(SC_MISSING_POSIX_HEADERS, [
+
+ AC_MSG_CHECKING(dirent.h)
+ AC_TRY_LINK([#include <sys/types.h>
+#include <dirent.h>], [
+#ifndef _POSIX_SOURCE
+# ifdef __Lynx__
+ /*
+ * Generate compilation error to make the test fail: Lynx headers
+ * are only valid if really in the POSIX environment.
+ */
+
+ missing_procedure();
+# endif
+#endif
+DIR *d;
+struct dirent *entryPtr;
+char *p;
+d = opendir("foobar");
+entryPtr = readdir(d);
+p = entryPtr->d_name;
+closedir(d);
+], tcl_ok=yes, tcl_ok=no)
+
+ if test $tcl_ok = no; then
+ AC_DEFINE(NO_DIRENT_H)
+ fi
+
+ AC_MSG_RESULT($tcl_ok)
+ AC_CHECK_HEADER(errno.h, , AC_DEFINE(NO_ERRNO_H))
+ AC_CHECK_HEADER(float.h, , AC_DEFINE(NO_FLOAT_H))
+ AC_CHECK_HEADER(values.h, , AC_DEFINE(NO_VALUES_H))
+ AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H))
+ AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
+ AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
+ AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
+ AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
+ if test $tcl_ok = 0; then
+ AC_DEFINE(NO_STDLIB_H)
+ fi
+ AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
+ AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
+ AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
+
+ # See also memmove check below for a place where NO_STRING_H can be
+ # set and why.
+
+ if test $tcl_ok = 0; then
+ AC_DEFINE(NO_STRING_H)
+ fi
+
+ AC_CHECK_HEADER(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
+ AC_CHECK_HEADER(dlfcn.h, , AC_DEFINE(NO_DLFCN_H))
+
+ # OS/390 lacks sys/param.h (and doesn't need it, by chance).
+
+ AC_HAVE_HEADERS(unistd.h sys/param.h)
+
+])
+
+#--------------------------------------------------------------------
+# SC_PATH_X
+#
+# Locate the X11 header files and the X11 library archive. Try
+# the ac_path_x macro first, but if it doesn't find the X stuff
+# (e.g. because there's no xmkmf program) then check through
+# a list of possible directories. Under some conditions the
+# autoconf macro will return an include directory that contains
+# no include files, so double-check its result just to be safe.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Sets the the following vars:
+# XINCLUDES
+# XLIBSW
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN(SC_PATH_X, [
+ AC_PATH_X
+ not_really_there=""
+ if test "$no_x" = ""; then
+ if test "$x_includes" = ""; then
+ AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
+ else
+ if test ! -r $x_includes/X11/Intrinsic.h; then
+ not_really_there="yes"
+ fi
+ fi
+ fi
+ if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
+ AC_MSG_CHECKING(for X11 header files)
+ XINCLUDES="# no special path needed"
+ AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
+ if test "$XINCLUDES" = nope; then
+ dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
+ for i in $dirs ; do
+ if test -r $i/X11/Intrinsic.h; then
+ AC_MSG_RESULT($i)
+ XINCLUDES=" -I$i"
+ break
+ fi
+ done
+ fi
+ else
+ if test "$x_includes" != ""; then
+ XINCLUDES=-I$x_includes
+ else
+ XINCLUDES="# no special path needed"
+ fi
+ fi
+ if test "$XINCLUDES" = nope; then
+ AC_MSG_RESULT(couldn't find any!)
+ XINCLUDES="# no include files found"
+ fi
+
+ if test "$no_x" = yes; then
+ AC_MSG_CHECKING(for X11 libraries)
+ XLIBSW=nope
+ dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
+ for i in $dirs ; do
+ if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
+ AC_MSG_RESULT($i)
+ XLIBSW="-L$i -lX11"
+ x_libraries="$i"
+ break
+ fi
+ done
+ else
+ if test "$x_libraries" = ""; then
+ XLIBSW=-lX11
+ else
+ XLIBSW="-L$x_libraries -lX11"
+ fi
+ fi
+ if test "$XLIBSW" = nope ; then
+ AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
+ fi
+ if test "$XLIBSW" = nope ; then
+ AC_MSG_RESULT(couldn't find any! Using -lX11.)
+ XLIBSW=-lX11
+ fi
+])
+#--------------------------------------------------------------------
+# SC_BLOCKING_STYLE
+#
+# The statements below check for systems where POSIX-style
+# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
+# On these systems (mostly older ones), use the old BSD-style
+# FIONBIO approach instead.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines some of the following vars:
+# HAVE_SYS_IOCTL_H
+# HAVE_SYS_FILIO_H
+# USE_FIONBIO
+# O_NONBLOCK
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN(SC_BLOCKING_STYLE, [
+ AC_CHECK_HEADERS(sys/ioctl.h)
+ AC_CHECK_HEADERS(sys/filio.h)
+ AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
+ if test -f /usr/lib/NextStep/software_version; then
+ system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
+ else
+ system=`uname -s`-`uname -r`
+ if test "$?" -ne 0 ; then
+ system=unknown
+ else
+ # Special check for weird MP-RAS system (uname returns weird
+ # results, and the version is kept in special file).
+
+ if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+ system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+ fi
+ if test "`uname -s`" = "AIX" ; then
+ system=AIX-`uname -v`.`uname -r`
+ fi
+ fi
+ fi
+ case $system in
+ # There used to be code here to use FIONBIO under AIX. However, it
+ # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
+ # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
+ # code (JO, 5/31/97).
+
+ OSF*)
+ AC_DEFINE(USE_FIONBIO)
+ AC_MSG_RESULT(FIONBIO)
+ ;;
+ SunOS-4*)
+ AC_DEFINE(USE_FIONBIO)
+ AC_MSG_RESULT(FIONBIO)
+ ;;
+ ULTRIX-4.*)
+ AC_DEFINE(USE_FIONBIO)
+ AC_MSG_RESULT(FIONBIO)
+ ;;
+ *)
+ AC_MSG_RESULT(O_NONBLOCK)
+ ;;
+ esac
+])
+
+#--------------------------------------------------------------------
+# SC_HAVE_VFORK
+#
+# Check to see whether the system provides a vfork kernel call.
+# If not, then use fork instead. Also, check for a problem with
+# vforks and signals that can cause core dumps if a vforked child
+# resets a signal handler. If the problem exists, then use fork
+# instead of vfork.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines some of the following vars:
+# vfork (=fork)
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN(SC_HAVE_VFORK, [
+ AC_TYPE_SIGNAL()
+ AC_CHECK_FUNC(vfork, tcl_ok=1, tcl_ok=0)
+ if test "$tcl_ok" = 1; then
+ AC_MSG_CHECKING([vfork/signal bug]);
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <signal.h>
+#include <sys/wait.h>
+int gotSignal = 0;
+sigProc(sig)
+ int sig;
+{
+ gotSignal = 1;
+}
+main()
+{
+ int pid, sts;
+ (void) signal(SIGCHLD, sigProc);
+ pid = vfork();
+ if (pid < 0) {
+ exit(1);
+ } else if (pid == 0) {
+ (void) signal(SIGCHLD, SIG_DFL);
+ _exit(0);
+ } else {
+ (void) wait(&sts);
+ }
+ exit((gotSignal) ? 0 : 1);
+}], tcl_ok=1, tcl_ok=0, tcl_ok=0)
+
+ if test "$tcl_ok" = 1; then
+ AC_MSG_RESULT(ok)
+ else
+ AC_MSG_RESULT([buggy, using fork instead])
+ fi
+ fi
+ rm -f core
+ if test "$tcl_ok" = 0; then
+ AC_DEFINE(vfork, fork)
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_TIME_HANLDER
+#
+# Checks how the system deals with time.h, what time structures
+# are used on the system, and what fields the structures have.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Defines some of the following vars:
+# USE_DELTA_FOR_TZ
+# HAVE_TM_GMTOFF
+# HAVE_TM_TZADJ
+# HAVE_TIMEZONE_VAR
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN(SC_TIME_HANDLER, [
+ AC_CHECK_HEADERS(sys/time.h)
+ AC_HEADER_TIME
+ AC_STRUCT_TIMEZONE
+
+ AC_MSG_CHECKING([tm_tzadj in struct tm])
+ AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
+ [AC_DEFINE(HAVE_TM_TZADJ)
+ AC_MSG_RESULT(yes)],
+ AC_MSG_RESULT(no))
+
+ AC_MSG_CHECKING([tm_gmtoff in struct tm])
+ AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
+ [AC_DEFINE(HAVE_TM_GMTOFF)
+ AC_MSG_RESULT(yes)],
+ AC_MSG_RESULT(no))
+
+ #
+ # Its important to include time.h in this check, as some systems
+ # (like convex) have timezone functions, etc.
+ #
+ have_timezone=no
+ AC_MSG_CHECKING([long timezone variable])
+ AC_TRY_COMPILE([#include <time.h>],
+ [extern long timezone;
+ timezone += 1;
+ exit (0);],
+ [have_timezone=yes
+ AC_DEFINE(HAVE_TIMEZONE_VAR)
+ AC_MSG_RESULT(yes)],
+ AC_MSG_RESULT(no))
+
+ #
+ # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
+ #
+ if test "$have_timezone" = no; then
+ AC_MSG_CHECKING([time_t timezone variable])
+ AC_TRY_COMPILE([#include <time.h>],
+ [extern time_t timezone;
+ timezone += 1;
+ exit (0);],
+ [AC_DEFINE(HAVE_TIMEZONE_VAR)
+ AC_MSG_RESULT(yes)],
+ AC_MSG_RESULT(no))
+ fi
+
+ #
+ # On some systems (eg Solaris 2.5.1), timezone is not declared in
+ # time.h unless you jump through hoops. Instead of that, we just
+ # declare it ourselves when necessary.
+ #
+ if test "$have_timezone" = yes; then
+ AC_MSG_CHECKING(for timezone declaration)
+ changequote(<<,>>)
+ tzrx='^[ ]*extern.*timezone'
+ changequote([,])
+ AC_EGREP_HEADER($tzrx, time.h, [
+ AC_DEFINE(HAVE_TIMEZONE_DECL)
+ AC_MSG_RESULT(found)], AC_MSG_RESULT(missing))
+ fi
+
+ #
+ # AIX does not have a timezone field in struct tm. When the AIX bsd
+ # library is used, the timezone global and the gettimeofday methods are
+ # to be avoided for timezone deduction instead, we deduce the timezone
+ # by comparing the localtime result on a known GMT value.
+ #
+
+ if test "`uname -s`" = "AIX" ; then
+ AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
+ if test $libbsd = yes; then
+ AC_DEFINE(USE_DELTA_FOR_TZ)
+ fi
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_BUGGY_STRTOD
+#
+# Under Solaris 2.4, strtod returns the wrong value for the
+# terminating character under some conditions. Check for this
+# and if the problem exists use a substitute procedure
+# "fixstrtod" (provided by Tcl) that corrects the error.
+# Also, on Compaq's Tru64 Unix 5.0,
+# strtod(" ") returns 0.0 instead of a failure to convert.
+#
+# Arguments:
+# none
+#
+# Results:
+#
+# Might defines some of the following vars:
+# strtod (=fixstrtod)
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN(SC_BUGGY_STRTOD, [
+ AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
+ if test "$tcl_strtod" = 1; then
+ AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs])
+ AC_TRY_RUN([
+ extern double strtod();
+ int main()
+ {
+ char *string = "NaN", *spaceString = " ";
+ char *term;
+ double value;
+ value = strtod(string, &term);
+ if ((term != string) && (term[-1] == 0)) {
+ exit(1);
+ }
+ value = strtod(spaceString, &term);
+ if (term == (spaceString+1)) {
+ exit(1);
+ }
+ exit(0);
+ }], tcl_ok=1, tcl_ok=0, tcl_ok=0)
+ if test "$tcl_ok" = 1; then
+ AC_MSG_RESULT(ok)
+ else
+ AC_MSG_RESULT(buggy)
+ LIBOBJS="$LIBOBJS fixstrtod.o"
+ AC_DEFINE(strtod, fixstrtod)
+ fi
+ fi
+])
+
+#--------------------------------------------------------------------
+# SC_TCL_LINK_LIBS
+#
+# Search for the libraries needed to link the Tcl shell.
+# Things like the math library (-lm) and socket stuff (-lsocket vs.
+# -lnsl) are dealt with here.
+#
+# Arguments:
+# Requires the following vars to be set in the Makefile:
+# DL_LIBS
+# LIBS
+# MATH_LIBS
+#
+# Results:
+#
+# Subst's the following var:
+# TCL_LIBS
+# MATH_LIBS
+#
+# Might append to the following vars:
+# LIBS
+#
+# Might define the following vars:
+# HAVE_NET_ERRNO_H
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN(SC_TCL_LINK_LIBS, [
+ #--------------------------------------------------------------------
+ # On a few very rare systems, all of the libm.a stuff is
+ # already in libc.a. Set compiler flags accordingly.
+ # Also, Linux requires the "ieee" library for math to work
+ # right (and it must appear before "-lm").
+ #--------------------------------------------------------------------
+
+ AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
+ AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
+
+ #--------------------------------------------------------------------
+ # On AIX systems, libbsd.a has to be linked in to support
+ # non-blocking file IO. This library has to be linked in after
+ # the MATH_LIBS or it breaks the pow() function. The way to
+ # insure proper sequencing, is to add it to the tail of MATH_LIBS.
+ # This library also supplies gettimeofday.
+ #--------------------------------------------------------------------
+
+ libbsd=no
+ if test "`uname -s`" = "AIX" ; then
+ AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
+ if test $libbsd = yes; then
+ MATH_LIBS="$MATH_LIBS -lbsd"
+ fi
+ fi
+
+
+ #--------------------------------------------------------------------
+ # Interactive UNIX requires -linet instead of -lsocket, plus it
+ # needs net/errno.h to define the socket-related error codes.
+ #--------------------------------------------------------------------
+
+ AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
+ AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H))
+
+ #--------------------------------------------------------------------
+ # Check for the existence of the -lsocket and -lnsl libraries.
+ # The order here is important, so that they end up in the right
+ # order in the command line generated by make. Here are some
+ # special considerations:
+ # 1. Use "connect" and "accept" to check for -lsocket, and
+ # "gethostbyname" to check for -lnsl.
+ # 2. Use each function name only once: can't redo a check because
+ # autoconf caches the results of the last check and won't redo it.
+ # 3. Use -lnsl and -lsocket only if they supply procedures that
+ # aren't already present in the normal libraries. This is because
+ # IRIX 5.2 has libraries, but they aren't needed and they're
+ # bogus: they goof up name resolution if used.
+ # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
+ # To get around this problem, check for both libraries together
+ # if -lsocket doesn't work by itself.
+ #--------------------------------------------------------------------
+
+ # CYGNUS LOCAL: Store any socket library(ies) in the cache, and don't
+ # mess up the cache values of the functions we check for.
+ AC_CACHE_CHECK([for socket libraries], tcl_cv_lib_sockets,
+ [tcl_cv_lib_sockets=
+ tcl_checkBoth=0
+ unset ac_cv_func_connect
+ AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
+ if test "$tcl_checkSocket" = 1; then
+ unset ac_cv_func_connect
+ AC_CHECK_LIB(socket, main, tcl_cv_lib_sockets="-lsocket",
+ tcl_checkBoth=1)
+ fi
+ if test "$tcl_checkBoth" = 1; then
+ tcl_oldLibs=$LIBS
+ LIBS="$LIBS -lsocket -lnsl"
+ unset ac_cv_func_accept
+ AC_CHECK_FUNC(accept,
+ [tcl_checkNsl=0
+ tcl_cv_lib_sockets="-lsocket -lnsl"])
+ unset ac_cv_func_accept
+ LIBS=$tcl_oldLibs
+ fi
+ unset ac_cv_func_gethostbyname
+ tcl_oldLibs=$LIBS
+ LIBS="$LIBS $tcl_cv_lib_sockets"
+ AC_CHECK_FUNC(gethostbyname, ,
+ [AC_CHECK_LIB(nsl, main,
+ [tcl_cv_lib_sockets="$tcl_cv_lib_sockets -lnsl"])])
+ unset ac_cv_func_gethostbyname
+ LIBS=$tcl_oldLIBS
+ ])
+ test -z "$tcl_cv_lib_sockets" || LIBS="$LIBS $tcl_cv_lib_sockets"
+
+ # Don't perform the eval of the libraries here because DL_LIBS
+ # won't be set until we call SC_CONFIG_CFLAGS
+
+ TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
+ AC_SUBST(TCL_LIBS)
+ AC_SUBST(MATH_LIBS)
+])
+
+dnl CYGNUS LOCAL: This gets the right posix flag for gcc
+
+AC_DEFUN(CY_AC_TCL_LYNX_POSIX,
+[AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
+AC_MSG_CHECKING([to see if this is LynxOS])
+AC_CACHE_VAL(ac_cv_os_lynx,
+[AC_EGREP_CPP(yes,
+[/*
+ * The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
+ */
+#if defined(__Lynx__) || defined(Lynx)
+yes
+#endif
+], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
+#
+if test "$ac_cv_os_lynx" = "yes" ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(LYNX)
+ AC_MSG_CHECKING([whether -mposix or -X is available])
+ AC_CACHE_VAL(ac_cv_c_posix_flag,
+ [AC_TRY_COMPILE(,[
+ /*
+ * This flag varies depending on how old the compiler is.
+ * -X is for the old "cc" and "gcc" (based on 1.42).
+ * -mposix is for the new gcc (at least 2.5.8).
+ */
+ #if defined(__GNUC__) && __GNUC__ >= 2
+ choke me
+ #endif
+ ], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")])
+ CC="$CC $ac_cv_c_posix_flag"
+ AC_MSG_RESULT($ac_cv_c_posix_flag)
+ else
+ AC_MSG_RESULT(no)
+fi
+])
diff --git a/tk/unix/tkAppInit.c b/tk/unix/tkAppInit.c
index 19fcd974fbc..ca7febb4453 100644
--- a/tk/unix/tkAppInit.c
+++ b/tk/unix/tkAppInit.c
@@ -5,7 +5,7 @@
* use in wish and similar Tk-based applications.
*
* Copyright (c) 1993 The Regents of the University of California.
- * Copyright (c) 1994 Sun Microsystems, Inc.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -14,6 +14,7 @@
*/
#include "tk.h"
+#include "locale.h"
/*
* The following variable is a special hack that is needed in order for
@@ -24,7 +25,8 @@ extern int matherr();
int *tclDummyMathPtr = (int *) matherr;
#ifdef TK_TEST
-EXTERN int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
#endif /* TK_TEST */
/*
@@ -49,7 +51,30 @@ main(argc, argv)
int argc; /* Number of command-line arguments. */
char **argv; /* Values of command-line arguments. */
{
- Tk_Main(argc, argv, Tcl_AppInit);
+ /*
+ * The following #if block allows you to change the AppInit
+ * function by using a #define of TCL_LOCAL_APPINIT instead
+ * of rewriting this entire file. The #if checks for that
+ * #define and uses Tcl_AppInit if it doesn't exist.
+ */
+
+#ifndef TK_LOCAL_APPINIT
+#define TK_LOCAL_APPINIT Tcl_AppInit
+#endif
+ extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
+
+ /*
+ * The following #if block allows you to change how Tcl finds the startup
+ * script, prime the library or encoding paths, fiddle with the argv,
+ * etc., without needing to rewrite Tk_Main()
+ */
+
+#ifdef TK_LOCAL_MAIN_HOOK
+ extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
+ TK_LOCAL_MAIN_HOOK(&argc, &argv);
+#endif
+
+ Tk_Main(argc, argv, TK_LOCAL_APPINIT);
return 0; /* Needed only to prevent compiler warning. */
}
@@ -64,7 +89,7 @@ main(argc, argv)
*
* Results:
* Returns a standard Tcl completion code, and leaves an error
- * message in interp->result if an error occurs.
+ * message in the interp's result if an error occurs.
*
* Side effects:
* Depends on the startup script.
@@ -84,6 +109,11 @@ Tcl_AppInit(interp)
}
Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
#ifdef TK_TEST
+ if (Tcltest_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
+ (Tcl_PackageInitProc *) NULL);
if (Tktest_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -118,3 +148,4 @@ Tcl_AppInit(interp)
Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
return TCL_OK;
}
+
diff --git a/tk/unix/tkConfig.sh.in b/tk/unix/tkConfig.sh.in
index 1caab785751..faa90d29203 100644
--- a/tk/unix/tkConfig.sh.in
+++ b/tk/unix/tkConfig.sh.in
@@ -25,6 +25,9 @@ TK_DEFS='@DEFS@'
# Flag, 1: we built a shared lib, 0 we didn't
TK_SHARED_BUILD=@TK_SHARED_BUILD@
+# This indicates if Tk was build with debugging symbols
+TK_DBGX=@TK_DBGX@
+
# The name of the Tk library (may be either a .a file or a shared library):
TK_LIB_FILE='@TK_LIB_FILE@'
@@ -54,6 +57,9 @@ TK_XINCLUDES='@XINCLUDES@'
# Linker switch(es) to use to link with the X11 library archive.
TK_XLIBSW='@XLIBSW@'
+# -l flag to pass to the linker to pick up the Tcl library
+TK_LIB_FLAG='@TK_LIB_FLAG@'
+
# String to pass to linker to pick up the Tk library from its
# build directory.
TK_BUILD_LIB_SPEC='@TK_BUILD_LIB_SPEC@'
@@ -75,3 +81,23 @@ TK_SRC_DIR='@TK_SRC_DIR@'
TK_CC_SEARCH_FLAGS='@TK_CC_SEARCH_FLAGS@'
TK_LD_SEARCH_FLAGS='@TK_LD_SEARCH_FLAGS@'
+# The name of the Tk stub library (.a):
+TK_STUB_LIB_FILE='@TK_STUB_LIB_FILE@'
+
+# -l flag to pass to the linker to pick up the Tk stub library
+TK_STUB_LIB_FLAG='@TK_STUB_LIB_FLAG@'
+
+# String to pass to linker to pick up the Tk stub library from its
+# build directory.
+TK_BUILD_STUB_LIB_SPEC='@TK_BUILD_STUB_LIB_SPEC@'
+
+# String to pass to linker to pick up the Tk stub library from its
+# installed directory.
+TK_STUB_LIB_SPEC='@TK_STUB_LIB_SPEC@'
+
+# Path to the Tk stub library in the build directory.
+TK_BUILD_STUB_LIB_PATH='@TK_BUILD_STUB_LIB_PATH@'
+
+# Path to the Tk stub library in the install directory.
+TK_STUB_LIB_PATH='@TK_STUB_LIB_PATH@'
+
diff --git a/tk/unix/tkUnix.c b/tk/unix/tkUnix.c
index 097b1b27828..3b099540eed 100644
--- a/tk/unix/tkUnix.c
+++ b/tk/unix/tkUnix.c
@@ -40,7 +40,8 @@ TkGetServerInfo(interp, tkwin)
Tk_Window tkwin; /* Token for window; this selects a
* particular display and server. */
{
- char buffer[50], buffer2[50];
+ char buffer[8 + TCL_INTEGER_SPACE * 2];
+ char buffer2[TCL_INTEGER_SPACE];
sprintf(buffer, "X%dR%d ", ProtocolVersion(Tk_Display(tkwin)),
ProtocolRevision(Tk_Display(tkwin)));
@@ -77,3 +78,32 @@ TkGetDefaultScreenName(interp, screenName)
}
return screenName;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_UpdatePointer --
+ *
+ * Unused function in UNIX
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_UpdatePointer(tkwin, x, y, state)
+ Tk_Window tkwin; /* Window to which pointer event
+ * is reported. May be NULL. */
+ int x, y; /* Pointer location in root coords. */
+ int state; /* Modifier state mask. */
+{
+ /*
+ * This function intentionally left blank
+ */
+}
+
diff --git a/tk/unix/tkUnix3d.c b/tk/unix/tkUnix3d.c
index b3493a79f28..9cab15094ed 100644
--- a/tk/unix/tkUnix3d.c
+++ b/tk/unix/tkUnix3d.c
@@ -14,6 +14,10 @@
#include <tk3d.h>
+#if !defined(__WIN32__) && !defined(MAC_TCL)
+#include "tkUnixInt.h"
+#endif
+
/*
* This structure is used to keep track of the extra colors used
* by Unix 3d borders.
@@ -335,6 +339,7 @@ TkpGetShadows(borderPtr, tkwin)
{
XColor lightColor, darkColor;
int stressed, tmp1, tmp2;
+ int r, g, b;
XGCValues gcValues;
if (borderPtr->lightGC != None) {
@@ -356,42 +361,81 @@ TkpGetShadows(borderPtr, tkwin)
/*
* This is a color display with lots of colors. For the dark
* shadow, cut 40% from each of the background color components.
+ * But if the background is already very dark, make the
+ * dark color a little lighter than the background by increasing
+ * each color component 1/4th of the way to MAX_INTENSITY.
+ *
* For the light shadow, boost each component by 40% or half-way
* to white, whichever is greater (the first approach works
* better for unsaturated colors, the second for saturated ones).
+ * But if the background is already very bright, instead choose a
+ * slightly darker color for the light shadow by reducing each
+ * color component by 10%.
+ *
+ * Compute the colors using integers, not using lightColor.red
+ * etc.: these are shorts and may have problems with integer
+ * overflow.
+ */
+
+ /*
+ * Compute the dark shadow color
+ */
+
+ r = (int) borderPtr->bgColorPtr->red;
+ g = (int) borderPtr->bgColorPtr->green;
+ b = (int) borderPtr->bgColorPtr->blue;
+
+ if (r*0.5*r + g*1.0*g + b*0.28*b < MAX_INTENSITY*0.05*MAX_INTENSITY) {
+ darkColor.red = (MAX_INTENSITY + 3*r)/4;
+ darkColor.green = (MAX_INTENSITY + 3*g)/4;
+ darkColor.blue = (MAX_INTENSITY + 3*b)/4;
+ } else {
+ darkColor.red = (60 * r)/100;
+ darkColor.green = (60 * g)/100;
+ darkColor.blue = (60 * b)/100;
+ }
+
+ /*
+ * Allocate the dark shadow color and its GC
*/
- darkColor.red = (60 * (int) borderPtr->bgColorPtr->red)/100;
- darkColor.green = (60 * (int) borderPtr->bgColorPtr->green)/100;
- darkColor.blue = (60 * (int) borderPtr->bgColorPtr->blue)/100;
borderPtr->darkColorPtr = Tk_GetColorByValue(tkwin, &darkColor);
gcValues.foreground = borderPtr->darkColorPtr->pixel;
borderPtr->darkGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
/*
- * Compute the colors using integers, not using lightColor.red
- * etc.: these are shorts and may have problems with integer
- * overflow.
+ * Compute the light shadow color
*/
- tmp1 = (14 * (int) borderPtr->bgColorPtr->red)/10;
- if (tmp1 > MAX_INTENSITY) {
- tmp1 = MAX_INTENSITY;
- }
- tmp2 = (MAX_INTENSITY + (int) borderPtr->bgColorPtr->red)/2;
- lightColor.red = (tmp1 > tmp2) ? tmp1 : tmp2;
- tmp1 = (14 * (int) borderPtr->bgColorPtr->green)/10;
- if (tmp1 > MAX_INTENSITY) {
- tmp1 = MAX_INTENSITY;
- }
- tmp2 = (MAX_INTENSITY + (int) borderPtr->bgColorPtr->green)/2;
- lightColor.green = (tmp1 > tmp2) ? tmp1 : tmp2;
- tmp1 = (14 * (int) borderPtr->bgColorPtr->blue)/10;
- if (tmp1 > MAX_INTENSITY) {
- tmp1 = MAX_INTENSITY;
+ if (g > MAX_INTENSITY*0.95) {
+ lightColor.red = (90 * r)/100;
+ lightColor.green = (90 * g)/100;
+ lightColor.blue = (90 * b)/100;
+ } else {
+ tmp1 = (14 * r)/10;
+ if (tmp1 > MAX_INTENSITY) {
+ tmp1 = MAX_INTENSITY;
+ }
+ tmp2 = (MAX_INTENSITY + r)/2;
+ lightColor.red = (tmp1 > tmp2) ? tmp1 : tmp2;
+ tmp1 = (14 * g)/10;
+ if (tmp1 > MAX_INTENSITY) {
+ tmp1 = MAX_INTENSITY;
+ }
+ tmp2 = (MAX_INTENSITY + g)/2;
+ lightColor.green = (tmp1 > tmp2) ? tmp1 : tmp2;
+ tmp1 = (14 * b)/10;
+ if (tmp1 > MAX_INTENSITY) {
+ tmp1 = MAX_INTENSITY;
+ }
+ tmp2 = (MAX_INTENSITY + b)/2;
+ lightColor.blue = (tmp1 > tmp2) ? tmp1 : tmp2;
}
- tmp2 = (MAX_INTENSITY + (int) borderPtr->bgColorPtr->blue)/2;
- lightColor.blue = (tmp1 > tmp2) ? tmp1 : tmp2;
+
+ /*
+ * Allocate the light shadow color and its GC
+ */
+
borderPtr->lightColorPtr = Tk_GetColorByValue(tkwin, &lightColor);
gcValues.foreground = borderPtr->lightColorPtr->pixel;
borderPtr->lightGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
@@ -446,3 +490,5 @@ TkpGetShadows(borderPtr, tkwin)
borderPtr->lightGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
}
}
+
+
diff --git a/tk/unix/tkUnixButton.c b/tk/unix/tkUnixButton.c
index 5a8acc03671..5f15d51fae5 100644
--- a/tk/unix/tkUnixButton.c
+++ b/tk/unix/tkUnixButton.c
@@ -4,7 +4,7 @@
* This file implements the Unix specific portion of the button
* widgets.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -85,12 +85,11 @@ TkpDisplayButton(clientData)
int x = 0; /* Initialization only needed to stop
* compiler warning. */
int y, relief;
- register Tk_Window tkwin = butPtr->tkwin;
+ Tk_Window tkwin = butPtr->tkwin;
int width, height;
- int offset; /* 0 means this is a label widget. 1 means
- * it is a flavor of button, so we offset
- * the text to make the button appear to
- * move up and down as the relief changes. */
+ int offset; /* 1 means this is a button widget, so we
+ * offset the text to make the button appear
+ * to move up and down as the relief changes. */
butPtr->flags &= ~REDRAW_PENDING;
if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
@@ -98,16 +97,16 @@ TkpDisplayButton(clientData)
}
border = butPtr->normalBorder;
- if ((butPtr->state == tkDisabledUid) && (butPtr->disabledFg != NULL)) {
+ if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) {
gc = butPtr->disabledGC;
- } else if ((butPtr->state == tkActiveUid)
+ } else if ((butPtr->state == STATE_ACTIVE)
&& !Tk_StrictMotif(butPtr->tkwin)) {
gc = butPtr->activeTextGC;
border = butPtr->activeBorder;
} else {
gc = butPtr->normalTextGC;
}
- if ((butPtr->flags & SELECTED) && (butPtr->state != tkActiveUid)
+ if ((butPtr->flags & SELECTED) && (butPtr->state != STATE_ACTIVE)
&& (butPtr->selectBorder != NULL) && !butPtr->indicatorOn) {
border = butPtr->selectBorder;
}
@@ -141,7 +140,7 @@ TkpDisplayButton(clientData)
* Display image or bitmap or text for button.
*/
- if (butPtr->image != None) {
+ if (butPtr->image != NULL) {
Tk_SizeOfImage(butPtr->image, &width, &height);
imageOrBitmap:
@@ -213,7 +212,7 @@ TkpDisplayButton(clientData)
y -= dim/2;
if (dim > 2*butPtr->borderWidth) {
Tk_Draw3DRectangle(tkwin, pixmap, border, x, y, dim, dim,
- butPtr->borderWidth,
+ butPtr->borderWidth,
(butPtr->flags & SELECTED) ? TK_RELIEF_SUNKEN :
TK_RELIEF_RAISED);
x += butPtr->borderWidth;
@@ -222,7 +221,7 @@ TkpDisplayButton(clientData)
if (butPtr->flags & SELECTED) {
GC gc;
- gc = Tk_3DBorderGC(tkwin,(butPtr->selectBorder != NULL)
+ gc = Tk_3DBorderGC(tkwin, (butPtr->selectBorder != NULL)
? butPtr->selectBorder : butPtr->normalBorder,
TK_3D_FLAT_GC);
XFillRectangle(butPtr->display, pixmap, gc, x, y,
@@ -269,7 +268,7 @@ TkpDisplayButton(clientData)
* must temporarily modify the GC.
*/
- if ((butPtr->state == tkDisabledUid)
+ if ((butPtr->state == STATE_DISABLED)
&& ((butPtr->disabledFg == NULL) || (butPtr->image != NULL))) {
if ((butPtr->flags & SELECTED) && !butPtr->indicatorOn
&& (butPtr->selectBorder != NULL)) {
@@ -297,7 +296,8 @@ TkpDisplayButton(clientData)
if (relief != TK_RELIEF_FLAT) {
int inset = butPtr->highlightWidth;
- if (butPtr->defaultState == tkActiveUid) {
+
+ if (butPtr->defaultState == DEFAULT_ACTIVE) {
/*
* Draw the default ring with 2 pixels of space between the
* default ring and the button and the default ring and the
@@ -319,15 +319,14 @@ TkpDisplayButton(clientData)
Tk_Height(tkwin) - 2*inset, 2, TK_RELIEF_FLAT);
inset += 2;
- } else if (butPtr->defaultState == tkNormalUid) {
+ } else if (butPtr->defaultState == DEFAULT_NORMAL) {
/*
* Leave room for the default ring and write over any text or
* background color.
*/
Tk_Draw3DRectangle(tkwin, pixmap, butPtr->highlightBorder, 0,
- 0, Tk_Width(tkwin),
- Tk_Height(tkwin), 5, TK_RELIEF_FLAT);
+ 0, Tk_Width(tkwin), Tk_Height(tkwin), 5, TK_RELIEF_FLAT);
inset += 5;
}
@@ -339,7 +338,7 @@ TkpDisplayButton(clientData)
Tk_Width(tkwin) - 2*inset, Tk_Height(tkwin) - 2*inset,
butPtr->borderWidth, relief);
}
- if (butPtr->highlightWidth != 0) {
+ if (butPtr->highlightWidth > 0) {
GC gc;
if (butPtr->flags & GOT_FOCUS) {
@@ -354,7 +353,7 @@ TkpDisplayButton(clientData)
* padding space left for a default ring.
*/
- if (butPtr->defaultState == tkNormalUid) {
+ if (butPtr->defaultState == DEFAULT_NORMAL) {
TkDrawInsetFocusHighlight(tkwin, gc, butPtr->highlightWidth,
pixmap, 5);
} else {
@@ -398,16 +397,13 @@ TkpComputeButtonGeometry(butPtr)
int width, height, avgWidth;
Tk_FontMetrics fm;
- if (butPtr->highlightWidth < 0) {
- butPtr->highlightWidth = 0;
- }
butPtr->inset = butPtr->highlightWidth + butPtr->borderWidth;
/*
* Leave room for the default ring if needed.
*/
- if (butPtr->defaultState != tkDisabledUid) {
+ if (butPtr->defaultState != DEFAULT_DISABLED) {
butPtr->inset += 5;
}
butPtr->indicatorSpace = 0;
@@ -433,9 +429,10 @@ TkpComputeButtonGeometry(butPtr)
goto imageOrBitmap;
} else {
Tk_FreeTextLayout(butPtr->textLayout);
+
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
- butPtr->text, -1, butPtr->wrapLength, butPtr->justify, 0,
- &butPtr->textWidth, &butPtr->textHeight);
+ Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength,
+ butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
width = butPtr->textWidth;
height = butPtr->textHeight;
@@ -476,3 +473,4 @@ TkpComputeButtonGeometry(butPtr)
+ 2*butPtr->inset), (int) (height + 2*butPtr->inset));
Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset);
}
+
diff --git a/tk/unix/tkUnixColor.c b/tk/unix/tkUnixColor.c
index d927351833b..ef3d77a4669 100644
--- a/tk/unix/tkUnixColor.c
+++ b/tk/unix/tkUnixColor.c
@@ -422,3 +422,4 @@ TkpCmapStressed(tkwin, colormap)
}
return 0;
}
+
diff --git a/tk/unix/tkUnixConfig.c b/tk/unix/tkUnixConfig.c
new file mode 100644
index 00000000000..9db523a9d40
--- /dev/null
+++ b/tk/unix/tkUnixConfig.c
@@ -0,0 +1,46 @@
+/*
+ * tkUnixConfig.c --
+ *
+ * This module implements the Unix system defaults for
+ * the configuration package.
+ *
+ * Copyright (c) 1997 by Sun Microsystems, Inc.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * RCS: @(#) $Id$
+ */
+
+#include "tk.h"
+#include "tkInt.h"
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetSystemDefault --
+ *
+ * Given a dbName and className for a configuration option,
+ * return a string representation of the option.
+ *
+ * Results:
+ * Returns a Tk_Uid that is the string identifier that identifies
+ * this option. Returns NULL if there are no system defaults
+ * that match this pair.
+ *
+ * Side effects:
+ * None, once the package is initialized.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Tcl_Obj *
+TkpGetSystemDefault(tkwin, dbName, className)
+ Tk_Window tkwin; /* A window to use. */
+ char *dbName; /* The option database name. */
+ char *className; /* The name of the option class. */
+{
+ return NULL;
+}
+
diff --git a/tk/unix/tkUnixCursor.c b/tk/unix/tkUnixCursor.c
index eb6e46030b5..54915b9c92c 100644
--- a/tk/unix/tkUnixCursor.c
+++ b/tk/unix/tkUnixCursor.c
@@ -3,7 +3,7 @@
*
* This file contains X specific cursor manipulation routines.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -218,7 +218,7 @@ TkGetCursorByName(interp, tkwin, string)
if (dispPtr->cursorFont == None) {
dispPtr->cursorFont = XLoadFont(display, CURSORFONT);
if (dispPtr->cursorFont == None) {
- interp->result = "couldn't load cursor font";
+ Tcl_SetResult(interp, "couldn't load cursor font", TCL_STATIC);
goto cleanup;
}
}
@@ -282,8 +282,9 @@ TkGetCursorByName(interp, tkwin, string)
goto cleanup;
}
if ((maskWidth != width) && (maskHeight != height)) {
- interp->result =
- "source and mask bitmaps have different sizes";
+ Tcl_SetResult(interp,
+ "source and mask bitmaps have different sizes",
+ TCL_STATIC);
goto cleanup;
}
if (XParseColor(display, Tk_Colormap(tkwin), argv[2],
@@ -323,6 +324,9 @@ TkGetCursorByName(interp, tkwin, string)
badString:
+ if (argv) {
+ ckfree((char *) argv);
+ }
Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"",
(char *) NULL);
return NULL;
@@ -382,7 +386,7 @@ TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
/*
*----------------------------------------------------------------------
*
- * TkFreeCursor --
+ * TkpFreeCursor --
*
* This procedure is called to release a cursor allocated by
* TkGetCursorByName.
@@ -397,11 +401,11 @@ TkCreateCursorFromData(tkwin, source, mask, width, height, xHot, yHot,
*/
void
-TkFreeCursor(cursorPtr)
+TkpFreeCursor(cursorPtr)
TkCursor *cursorPtr;
{
TkUnixCursor *unixCursorPtr = (TkUnixCursor *) cursorPtr;
XFreeCursor(unixCursorPtr->display, (Cursor) unixCursorPtr->info.cursor);
Tk_FreeXId(unixCursorPtr->display, (XID) unixCursorPtr->info.cursor);
- ckfree((char *) unixCursorPtr);
}
+
diff --git a/tk/unix/tkUnixDefault.h b/tk/unix/tkUnixDefault.h
index bc9e0ac8ea8..0bc3f966b1b 100644
--- a/tk/unix/tkUnixDefault.h
+++ b/tk/unix/tkUnixDefault.h
@@ -59,7 +59,8 @@
#define DEF_CHKRAD_FG DEF_BUTTON_FG
#define DEF_BUTTON_FONT "Helvetica -12 bold"
#define DEF_BUTTON_HEIGHT "0"
-#define DEF_BUTTON_HIGHLIGHT_BG NORMAL_BG
+#define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR
+#define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO
#define DEF_BUTTON_HIGHLIGHT BLACK
#define DEF_LABEL_HIGHLIGHT_WIDTH "0"
#define DEF_BUTTON_HIGHLIGHT_WIDTH "1"
@@ -197,6 +198,7 @@
#define DEF_LISTBOX_HIGHLIGHT_WIDTH "1"
#define DEF_LISTBOX_RELIEF "sunken"
#define DEF_LISTBOX_SCROLL_COMMAND ""
+#define DEF_LISTBOX_LIST_VARIABLE ""
#define DEF_LISTBOX_SELECT_COLOR SELECT_BG
#define DEF_LISTBOX_SELECT_MONO BLACK
#define DEF_LISTBOX_SELECT_BD "1"
@@ -282,7 +284,8 @@
#define DEF_MENUBUTTON_FONT "Helvetica -12 bold"
#define DEF_MENUBUTTON_FG BLACK
#define DEF_MENUBUTTON_HEIGHT "0"
-#define DEF_MENUBUTTON_HIGHLIGHT_BG NORMAL_BG
+#define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR
+#define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
#define DEF_MENUBUTTON_HIGHLIGHT BLACK
#define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
#define DEF_MENUBUTTON_IMAGE (char *) NULL
@@ -341,14 +344,15 @@
#define DEF_SCALE_FG_COLOR BLACK
#define DEF_SCALE_FG_MONO BLACK
#define DEF_SCALE_FROM "0"
-#define DEF_SCALE_HIGHLIGHT_BG NORMAL_BG
+#define DEF_SCALE_HIGHLIGHT_BG_COLOR DEF_SCALE_BG_COLOR
+#define DEF_SCALE_HIGHLIGHT_BG_MONO DEF_SCALE_BG_MONO
#define DEF_SCALE_HIGHLIGHT BLACK
#define DEF_SCALE_HIGHLIGHT_WIDTH "1"
#define DEF_SCALE_LABEL ""
#define DEF_SCALE_LENGTH "100"
#define DEF_SCALE_ORIENT "vertical"
#define DEF_SCALE_RELIEF "flat"
-#define DEF_SCALE_REPEAT_DELAY "300"
+#define DEF_SCALE_REPEAT_DELAY "300"
#define DEF_SCALE_REPEAT_INTERVAL "100"
#define DEF_SCALE_RESOLUTION "1"
#define DEF_SCALE_TROUGH_COLOR TROUGH
@@ -449,3 +453,4 @@
#define DEF_TOPLEVEL_SCREEN ""
#endif /* _TKUNIXDEFAULT */
+
diff --git a/tk/unix/tkUnixDialog.c b/tk/unix/tkUnixDialog.c
index 81bcb840759..b9554327af0 100644
--- a/tk/unix/tkUnixDialog.c
+++ b/tk/unix/tkUnixDialog.c
@@ -126,7 +126,6 @@ Tk_ChooseColorCmd(clientData, interp, argc, argv)
*
*----------------------------------------------------------------------
*/
-int SN_donot_call_motif_filedialog_box = 0;
int
Tk_GetOpenFileCmd(clientData, interp, argc, argv)
@@ -137,8 +136,7 @@ Tk_GetOpenFileCmd(clientData, interp, argc, argv)
{
Tk_Window tkwin = (Tk_Window)clientData;
- /* Don't use motif dialog box */
- if (SN_donot_call_motif_filedialog_box == 0 && Tk_StrictMotif(tkwin)) {
+ if (Tk_StrictMotif(tkwin)) {
return EvalArgv(interp, "tkMotifFDialog", argc, argv);
} else {
return EvalArgv(interp, "tkFDialog", argc, argv);
@@ -171,8 +169,7 @@ Tk_GetSaveFileCmd(clientData, interp, argc, argv)
{
Tk_Window tkwin = (Tk_Window)clientData;
- /* Don't use motif dialog box */
- if (SN_donot_call_motif_filedialog_box == 0 && Tk_StrictMotif(tkwin)) {
+ if (Tk_StrictMotif(tkwin)) {
return EvalArgv(interp, "tkMotifFDialog", argc, argv);
} else {
return EvalArgv(interp, "tkFDialog", argc, argv);
@@ -208,3 +205,4 @@ Tk_MessageBoxCmd(clientData, interp, argc, argv)
return EvalArgv(interp, "tkMessageBox", argc, argv);
}
+
diff --git a/tk/unix/tkUnixDraw.c b/tk/unix/tkUnixDraw.c
index 42aa3560b88..2a135aa4036 100644
--- a/tk/unix/tkUnixDraw.c
+++ b/tk/unix/tkUnixDraw.c
@@ -14,6 +14,10 @@
#include "tkPort.h"
#include "tkInt.h"
+#if !defined(__WIN32__) && !defined(MAC_TCL)
+#include "tkUnixInt.h"
+#endif
+
/*
* The following structure is used to pass information to
* ScrollRestrictProc from TkScrollWindow.
@@ -168,4 +172,37 @@ ScrollRestrictProc(arg, eventPtr)
}
return TK_DISCARD_EVENT;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawHighlightBorder --
+ *
+ * This procedure draws a rectangular ring around the outside of
+ * a widget to indicate that it has received the input focus.
+ *
+ * On Unix, we just draw the simple inset ring. On other sytems,
+ * e.g. the Mac, the focus ring is a little more complicated, so we
+ * need this abstraction.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A rectangle "width" pixels wide is drawn in "drawable",
+ * corresponding to the outer area of "tkwin".
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
+ Tk_Window tkwin;
+ GC fgGC;
+ GC bgGC;
+ int highlightWidth;
+ Drawable drawable;
+{
+ TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
+}
diff --git a/tk/unix/tkUnixEmbed.c b/tk/unix/tkUnixEmbed.c
index fb8fe3f5679..e52a06226de 100644
--- a/tk/unix/tkUnixEmbed.c
+++ b/tk/unix/tkUnixEmbed.c
@@ -46,9 +46,11 @@ typedef struct Container {
* this process. */
} Container;
-static Container *firstContainerPtr = NULL;
- /* First in list of all containers
+typedef struct ThreadSpecificData {
+ Container *firstContainerPtr; /* First in list of all containers
* managed by this process. */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
* Prototypes for static procedures defined in this file:
@@ -83,7 +85,7 @@ static void EmbedWindowDeleted _ANSI_ARGS_((TkWindow *winPtr));
* Results:
* The return value is normally TCL_OK. If an error occurs (such
* as string not being a valid window spec), then the return value
- * is TCL_ERROR and an error message is left in interp->result if
+ * is TCL_ERROR and an error message is left in the interp's result if
* interp is non-NULL.
*
* Side effects:
@@ -108,6 +110,8 @@ TkpUseWindow(interp, tkwin, string)
Tk_ErrorHandler handler;
Container *containerPtr;
XWindowAttributes parentAtts;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->window != None) {
panic("TkUseWindow: X window already assigned");
@@ -157,7 +161,7 @@ TkpUseWindow(interp, tkwin, string)
* app. are in the same process.
*/
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
+ for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
if (containerPtr->parent == parent) {
winPtr->flags |= TK_BOTH_HALVES;
@@ -171,8 +175,8 @@ TkpUseWindow(interp, tkwin, string)
containerPtr->parentRoot = parentAtts.root;
containerPtr->parentPtr = NULL;
containerPtr->wrapper = None;
- containerPtr->nextPtr = firstContainerPtr;
- firstContainerPtr = containerPtr;
+ containerPtr->nextPtr = tsdPtr->firstContainerPtr;
+ tsdPtr->firstContainerPtr = containerPtr;
}
containerPtr->embeddedPtr = winPtr;
winPtr->flags |= TK_EMBEDDED;
@@ -204,6 +208,8 @@ TkpMakeWindow(winPtr, parent)
* which the window is to be created. */
{
Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_EMBEDDED) {
/*
@@ -213,7 +219,7 @@ TkpMakeWindow(winPtr, parent)
* into a wrapper window later.
*/
- for (containerPtr = firstContainerPtr; ;
+ for (containerPtr = tsdPtr->firstContainerPtr; ;
containerPtr = containerPtr->nextPtr) {
if (containerPtr == NULL) {
panic("TkMakeWindow couldn't find container for window");
@@ -259,6 +265,8 @@ TkpMakeContainer(tkwin)
{
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Register the window as a container so that, for example, we can
@@ -272,8 +280,8 @@ TkpMakeContainer(tkwin)
containerPtr->parentPtr = winPtr;
containerPtr->wrapper = None;
containerPtr->embeddedPtr = NULL;
- containerPtr->nextPtr = firstContainerPtr;
- firstContainerPtr = containerPtr;
+ containerPtr->nextPtr = tsdPtr->firstContainerPtr;
+ tsdPtr->firstContainerPtr = containerPtr;
winPtr->flags |= TK_CONTAINER;
/*
@@ -383,6 +391,8 @@ ContainerEventProc(clientData, eventPtr)
TkWindow *winPtr = (TkWindow *) clientData;
Container *containerPtr;
Tk_ErrorHandler errHandler;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Ignore any X protocol errors that happen in this procedure
@@ -397,7 +407,7 @@ ContainerEventProc(clientData, eventPtr)
* Find the Container structure associated with the parent window.
*/
- for (containerPtr = firstContainerPtr;
+ for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr->parent != eventPtr->xmaprequest.parent;
containerPtr = containerPtr->nextPtr) {
if (containerPtr == NULL) {
@@ -697,8 +707,11 @@ TkpGetOtherWindow(winPtr)
* embedded window. */
{
Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
+ for (containerPtr = tsdPtr->firstContainerPtr;
+ containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
return containerPtr->parentPtr;
@@ -741,6 +754,8 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
{
Container *containerPtr;
Window saved;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* First, find the top-level window corresponding to winPtr.
@@ -769,7 +784,7 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
* application. Send the event back to the container.
*/
- for (containerPtr = firstContainerPtr;
+ for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr->embeddedPtr != winPtr;
containerPtr = containerPtr->nextPtr) {
/* Empty loop body. */
@@ -811,12 +826,14 @@ TkpClaimFocus(topLevelPtr, force)
{
XEvent event;
Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(topLevelPtr->flags & TK_EMBEDDED)) {
return;
}
- for (containerPtr = firstContainerPtr;
+ for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr->embeddedPtr != topLevelPtr;
containerPtr = containerPtr->nextPtr) {
/* Empty loop body. */
@@ -861,6 +878,8 @@ TkpTestembedCmd(clientData, interp, argc, argv)
Container *containerPtr;
Tcl_DString dString;
char buffer[50];
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if ((argc > 1) && (strcmp(argv[1], "all") == 0)) {
all = 1;
@@ -868,7 +887,7 @@ TkpTestembedCmd(clientData, interp, argc, argv)
all = 0;
}
Tcl_DStringInit(&dString);
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
+ for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
Tcl_DStringStartSublist(&dString);
if (containerPtr->parent == None) {
@@ -933,6 +952,8 @@ EmbedWindowDeleted(winPtr)
* was deleted. */
{
Container *containerPtr, *prevPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Find the Container structure for this window work. Delete the
@@ -941,7 +962,7 @@ EmbedWindowDeleted(winPtr)
*/
prevPtr = NULL;
- containerPtr = firstContainerPtr;
+ containerPtr = tsdPtr->firstContainerPtr;
while (1) {
if (containerPtr->embeddedPtr == winPtr) {
containerPtr->wrapper = None;
@@ -958,7 +979,7 @@ EmbedWindowDeleted(winPtr)
if ((containerPtr->embeddedPtr == NULL)
&& (containerPtr->parentPtr == NULL)) {
if (prevPtr == NULL) {
- firstContainerPtr = containerPtr->nextPtr;
+ tsdPtr->firstContainerPtr = containerPtr->nextPtr;
} else {
prevPtr->nextPtr = containerPtr->nextPtr;
}
@@ -989,9 +1010,11 @@ TkUnixContainerId(winPtr)
TkWindow *winPtr; /* Tk's structure for an embedded window. */
{
Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
- containerPtr = containerPtr->nextPtr) {
+ for (containerPtr = tsdPtr->firstContainerPtr;
+ containerPtr != NULL; containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
return containerPtr->parent;
}
@@ -999,3 +1022,4 @@ TkUnixContainerId(winPtr)
panic("TkUnixContainerId couldn't find window");
return None;
}
+
diff --git a/tk/unix/tkUnixEvent.c b/tk/unix/tkUnixEvent.c
index fbb99cd1598..f90963be892 100644
--- a/tk/unix/tkUnixEvent.c
+++ b/tk/unix/tkUnixEvent.c
@@ -17,10 +17,14 @@
#include <signal.h>
/*
- * The following static indicates whether this module has been initialized.
+ * The following static indicates whether this module has been initialized
+ * in the current thread.
*/
-static int initialized = 0;
+typedef struct ThreadSpecificData {
+ int initialized;
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
* Prototypes for procedures that are referenced only in this file:
@@ -34,6 +38,8 @@ static void DisplayFileProc _ANSI_ARGS_((ClientData clientData,
int flags));
static void DisplaySetupProc _ANSI_ARGS_((ClientData clientData,
int flags));
+static void TransferXEventsToTcl _ANSI_ARGS_((Display *display));
+
/*
*----------------------------------------------------------------------
@@ -55,8 +61,11 @@ static void DisplaySetupProc _ANSI_ARGS_((ClientData clientData,
void
TkCreateXEventSource()
{
- if (!initialized) {
- initialized = 1;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ if (!tsdPtr->initialized) {
+ tsdPtr->initialized = 1;
Tcl_CreateEventSource(DisplaySetupProc, DisplayCheckProc, NULL);
Tcl_CreateExitHandler(DisplayExitHandler, NULL);
}
@@ -83,8 +92,11 @@ static void
DisplayExitHandler(clientData)
ClientData clientData; /* Not used. */
{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
Tcl_DeleteEventSource(DisplaySetupProc, DisplayCheckProc, NULL);
- initialized = 0;
+ tsdPtr->initialized = 0;
}
/*
@@ -185,7 +197,7 @@ DisplaySetupProc(clientData, flags)
return;
}
- for (dispPtr = tkDisplayList; dispPtr != NULL;
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
/*
@@ -196,7 +208,7 @@ DisplaySetupProc(clientData, flags)
*/
XFlush(dispPtr->display);
- if (XQLength(dispPtr->display) > 0) {
+ if (QLength(dispPtr->display) > 0) {
Tcl_SetMaxBlockTime(&blockTime);
}
}
@@ -205,6 +217,43 @@ DisplaySetupProc(clientData, flags)
/*
*----------------------------------------------------------------------
*
+ * TransferXEventsToTcl
+ *
+ * Transfer events from the X event queue to the Tk event queue.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Moves queued X events onto the Tcl event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+
+static void
+TransferXEventsToTcl(display)
+ Display *display;
+{
+ int numFound;
+ XEvent event;
+
+ numFound = QLength(display);
+
+ /*
+ * Transfer events from the X event queue to the Tk event queue.
+ */
+
+ while (numFound > 0) {
+ XNextEvent(display, &event);
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ numFound--;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* DisplayCheckProc --
*
* This procedure checks for events sitting in the X event
@@ -225,29 +274,19 @@ DisplayCheckProc(clientData, flags)
int flags;
{
TkDisplay *dispPtr;
- XEvent event;
- int numFound;
if (!(flags & TCL_WINDOW_EVENTS)) {
return;
}
- for (dispPtr = tkDisplayList; dispPtr != NULL;
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
XFlush(dispPtr->display);
- numFound = XQLength(dispPtr->display);
-
- /*
- * Transfer events from the X event queue to the Tk event queue.
- */
-
- while (numFound > 0) {
- XNextEvent(dispPtr->display, &event);
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- numFound--;
- }
+ TransferXEventsToTcl(dispPtr->display);
}
}
+
+
/*
*----------------------------------------------------------------------
@@ -273,7 +312,6 @@ DisplayFileProc(clientData, flags)
{
TkDisplay *dispPtr = (TkDisplay *) clientData;
Display *display = dispPtr->display;
- XEvent event;
int numFound;
XFlush(display);
@@ -311,15 +349,7 @@ DisplayFileProc(clientData, flags)
(void) signal(SIGPIPE, oldHandler);
}
- /*
- * Transfer events from the X event queue to the Tk event queue.
- */
-
- while (numFound > 0) {
- XNextEvent(display, &event);
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- numFound--;
- }
+ TransferXEventsToTcl(display);
}
/*
@@ -394,10 +424,10 @@ TkUnixDoOneXEvent(timePtr)
*/
memset((VOID *) readMask, 0, MASK_SIZE*sizeof(fd_mask));
- for (dispPtr = tkDisplayList; dispPtr != NULL;
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
XFlush(dispPtr->display);
- if (XQLength(dispPtr->display) > 0) {
+ if (QLength(dispPtr->display) > 0) {
blockTime.tv_sec = 0;
blockTime.tv_usec = 0;
}
@@ -425,12 +455,12 @@ TkUnixDoOneXEvent(timePtr)
* Process any new events on the display connections.
*/
- for (dispPtr = tkDisplayList; dispPtr != NULL;
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
fd = ConnectionNumber(dispPtr->display);
index = fd/(NBBY*sizeof(fd_mask));
bit = 1 << (fd%(NBBY*sizeof(fd_mask)));
- if ((readMask[index] & bit) || (XQLength(dispPtr->display) > 0)) {
+ if ((readMask[index] & bit) || (QLength(dispPtr->display) > 0)) {
DisplayFileProc((ClientData)dispPtr, TCL_READABLE);
}
}
@@ -480,19 +510,12 @@ void
TkpSync(display)
Display *display; /* Display to sync. */
{
- int numFound = 0;
- XEvent event;
-
XSync(display, False);
/*
* Transfer events from the X event queue to the Tk event queue.
*/
+ TransferXEventsToTcl(display);
- numFound = XQLength(display);
- while (numFound > 0) {
- XNextEvent(display, &event);
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- numFound--;
- }
}
+
diff --git a/tk/unix/tkUnixFocus.c b/tk/unix/tkUnixFocus.c
index c6d11a7cb6f..51e4b56c243 100644
--- a/tk/unix/tkUnixFocus.c
+++ b/tk/unix/tkUnixFocus.c
@@ -16,7 +16,6 @@
#include "tkPort.h"
#include "tkUnixInt.h"
-extern int tclFocusDebug;
/*
*----------------------------------------------------------------------
@@ -147,3 +146,4 @@ TkpChangeFocus(winPtr, force)
XFlush(dispPtr->display);
return serial;
}
+
diff --git a/tk/unix/tkUnixFont.c b/tk/unix/tkUnixFont.c
index 7f48de28ea3..f9e4229f5c9 100644
--- a/tk/unix/tkUnixFont.c
+++ b/tk/unix/tkUnixFont.c
@@ -4,7 +4,7 @@
* Contains the Unix implementation of the platform-independant
* font package interface.
*
- * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright (c) 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -12,88 +12,379 @@
* RCS: @(#) $Id$
*/
-#include "tkPort.h"
-#include "tkInt.h"
#include "tkUnixInt.h"
-
#include "tkFont.h"
-#ifndef ABS
-#define ABS(n) (((n) < 0) ? -(n) : (n))
-#endif
+/*
+ * The preferred font encodings.
+ */
+
+static CONST char *encodingList[] = {
+ "iso8859-1", "jis0208", "jis0212", NULL
+};
+
+/*
+ * The following structure represents a font family. It is assumed that
+ * all screen fonts constructed from the same "font family" share certain
+ * properties; all screen fonts with the same "font family" point to a
+ * shared instance of this structure. The most important shared property
+ * is the character existence metrics, used to determine if a screen font
+ * can display a given Unicode character.
+ *
+ * Under Unix, there are three attributes that uniquely identify a "font
+ * family": the foundry, face name, and charset.
+ */
+
+#define FONTMAP_SHIFT 10
+
+#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
+#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
+
+typedef struct FontFamily {
+ struct FontFamily *nextPtr; /* Next in list of all known font families. */
+ int refCount; /* How many SubFonts are referring to this
+ * FontFamily. When the refCount drops to
+ * zero, this FontFamily may be freed. */
+ /*
+ * Key.
+ */
+
+ Tk_Uid foundry; /* Foundry key for this FontFamily. */
+ Tk_Uid faceName; /* Face name key for this FontFamily. */
+ Tcl_Encoding encoding; /* Encoding key for this FontFamily. */
+
+ /*
+ * Derived properties.
+ */
+
+ int isTwoByteFont; /* 1 if this is a double-byte font, 0
+ * otherwise. */
+ char *fontMap[FONTMAP_PAGES];
+ /* Two-level sparse table used to determine
+ * quickly if the specified character exists.
+ * As characters are encountered, more pages
+ * in this table are dynamically alloced. The
+ * contents of each page is a bitmask
+ * consisting of FONTMAP_BITSPERPAGE bits,
+ * representing whether this font can be used
+ * to display the given character at the
+ * corresponding bit position. The high bits
+ * of the character are used to pick which
+ * page of the table is used. */
+} FontFamily;
+
+/*
+ * The following structure encapsulates an individual screen font. A font
+ * object is made up of however many SubFonts are necessary to display a
+ * stream of multilingual characters.
+ */
+
+typedef struct SubFont {
+ char **fontMap; /* Pointer to font map from the FontFamily,
+ * cached here to save a dereference. */
+ XFontStruct *fontStructPtr; /* The specific screen font that will be
+ * used when displaying/measuring chars
+ * belonging to the FontFamily. */
+ FontFamily *familyPtr; /* The FontFamily for this SubFont. */
+} SubFont;
/*
- * The following structure represents Unix's implementation of a font.
+ * The following structure represents Unix's implementation of a font
+ * object.
*/
+#define SUBFONT_SPACE 3
+#define BASE_CHARS 256
+
typedef struct UnixFont {
TkFont font; /* Stuff used by generic font package. Must
* be first in structure. */
- Display *display; /* The display to which font belongs. */
- XFontStruct *fontStructPtr; /* X information about font. */
- char types[256]; /* Array giving types of all characters in
- * the font, used when displaying control
- * characters. See below for definition. */
- int widths[256]; /* Array giving widths of all possible
- * characters in the font. */
+ SubFont staticSubFonts[SUBFONT_SPACE];
+ /* Builtin space for a limited number of
+ * SubFonts. */
+ int numSubFonts; /* Length of following array. */
+ SubFont *subFontArray; /* Array of SubFonts that have been loaded
+ * in order to draw/measure all the characters
+ * encountered by this font so far. All fonts
+ * start off with one SubFont initialized by
+ * AllocFont() from the original set of font
+ * attributes. Usually points to
+ * staticSubFonts, but may point to malloced
+ * space if there are lots of SubFonts. */
+ SubFont controlSubFont; /* Font to use to display control-character
+ * expansions. */
+
+ Display *display; /* Display that owns font. */
+ int pixelSize; /* Original pixel size used when font was
+ * constructed. */
+ TkXLFDAttributes xa; /* Additional attributes that specify the
+ * preferred foundry and encoding to use when
+ * constructing additional SubFonts. */
+ int widths[BASE_CHARS]; /* Widths of first 256 chars in the base
+ * font, for handling common case. */
int underlinePos; /* Offset from baseline to origin of
- * underline bar (used for simulating a native
- * underlined font). */
+ * underline bar (used when drawing underlined
+ * font) (pixels). */
int barHeight; /* Height of underline or overstrike bar
- * (used for simulating a native underlined or
- * strikeout font). */
+ * (used when drawing underlined or strikeout
+ * font) (pixels). */
} UnixFont;
/*
- * Possible values for entries in the "types" field in a UnixFont structure,
- * which classifies the types of all characters in the given font. This
- * information is used when measuring and displaying characters.
- *
- * NORMAL: Standard character.
- * REPLACE: This character doesn't print: instead of
- * displaying character, display a replacement
- * sequence like "\n" (for those characters where
- * ANSI C defines such a sequence) or a sequence
- * of the form "\xdd" where dd is the hex equivalent
- * of the character.
- * SKIP: Don't display anything for this character. This
- * is only used where the font doesn't contain
- * all the characters needed to generate
- * replacement sequences.
- */
-
-#define NORMAL 0
-#define REPLACE 1
-#define SKIP 2
+ * The following structure and definition is used to keep track of the
+ * alternative names for various encodings. Asking for an encoding that
+ * matches one of the alias patterns will result in actually getting the
+ * encoding by its real name.
+ */
+
+typedef struct EncodingAlias {
+ char *realName; /* The real name of the encoding to load if
+ * the provided name matched the pattern. */
+ char *aliasPattern; /* Pattern for encoding name, of the form
+ * that is acceptable to Tcl_StringMatch. */
+} EncodingAlias;
/*
- * Characters used when displaying control sequences.
+ * Just some utility structures used for passing around values in helper
+ * procedures.
*/
+
+typedef struct FontAttributes {
+ TkFontAttributes fa;
+ TkXLFDAttributes xa;
+} FontAttributes;
+
+
+typedef struct ThreadSpecificData {
+ FontFamily *fontFamilyList; /* The list of font families that are
+ * currently loaded. As screen fonts
+ * are loaded, this list grows to hold
+ * information about what characters
+ * exist in each font family. */
+ FontFamily controlFamily; /* FontFamily used to handle control
+ * character expansions. The encoding
+ * of this FontFamily converts UTF-8 to
+ * backslashed escape sequences. */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
-static char hexChars[] = "0123456789abcdefxtnvr\\";
+/*
+ * The set of builtin encoding alises to convert the XLFD names for the
+ * encodings into the names expected by the Tcl encoding package.
+ */
+
+static EncodingAlias encodingAliases[] = {
+ {"gb2312", "gb2312*"},
+ {"big5", "big5*"},
+ {"cns11643-1", "cns11643*-1"},
+ {"cns11643-1", "cns11643*.1-0"},
+ {"cns11643-2", "cns11643*-2"},
+ {"cns11643-2", "cns11643*.2-0"},
+ {"jis0201", "jisx0202*"},
+ {"jis0208", "jisc6226*"},
+ {"jis0208", "jisx0208*"},
+ {"jis0212", "jisx0212*"},
+ {"tis620", "tis620*"},
+ {"ksc5601", "ksc5601*"},
+ {"dingbats", "*dingbats"},
+ {NULL, NULL}
+};
/*
- * The following table maps some control characters to sequences like '\n'
- * rather than '\x10'. A zero entry in the table means no such mapping
- * exists, and the table only maps characters less than 0x10.
+ * Procedures used only in this file.
*/
-static char mapChars[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 'a', 'b', 't', 'n', 'v', 'f', 'r',
- 0
-};
+static FontFamily * AllocFontFamily _ANSI_ARGS_((Display *display,
+ XFontStruct *fontStructPtr, int base));
+static SubFont * CanUseFallback _ANSI_ARGS_((UnixFont *fontPtr,
+ char *fallbackName, int ch));
+static SubFont * CanUseFallbackWithAliases _ANSI_ARGS_((
+ UnixFont *fontPtr, char *fallbackName,
+ int ch, Tcl_DString *nameTriedPtr));
+static int ControlUtfProc _ANSI_ARGS_((ClientData clientData,
+ CONST char *src, int srcLen, int flags,
+ Tcl_EncodingState *statePtr, char *dst,
+ int dstLen, int *srcReadPtr, int *dstWrotePtr,
+ int *dstCharsPtr));
+static XFontStruct * CreateClosestFont _ANSI_ARGS_((Tk_Window tkwin,
+ CONST TkFontAttributes *faPtr,
+ CONST TkXLFDAttributes *xaPtr));
+static SubFont * FindSubFontForChar _ANSI_ARGS_((UnixFont *fontPtr,
+ int ch));
+static void FontMapInsert _ANSI_ARGS_((SubFont *subFontPtr,
+ int ch));
+static void FontMapLoadPage _ANSI_ARGS_((SubFont *subFontPtr,
+ int row));
+static int FontMapLookup _ANSI_ARGS_((SubFont *subFontPtr,
+ int ch));
+static void FreeFontFamily _ANSI_ARGS_((FontFamily *afPtr));
+static CONST char * GetEncodingAlias _ANSI_ARGS_((CONST char *name));
+static int GetFontAttributes _ANSI_ARGS_((Display *display,
+ XFontStruct *fontStructPtr, FontAttributes *faPtr));
+static XFontStruct * GetScreenFont _ANSI_ARGS_((Display *display,
+ FontAttributes *wantPtr, char **nameList,
+ int bestIdx[], unsigned int bestScore[]));
+static XFontStruct * GetSystemFont _ANSI_ARGS_((Display *display));
+static int IdentifySymbolEncodings _ANSI_ARGS_((
+ FontAttributes *faPtr));
+static void InitFont _ANSI_ARGS_((Tk_Window tkwin,
+ XFontStruct *fontStructPtr, UnixFont *fontPtr));
+static void InitSubFont _ANSI_ARGS_((Display *display,
+ XFontStruct *fontStructPtr, int base,
+ SubFont *subFontPtr));
+static char ** ListFonts _ANSI_ARGS_((Display *display,
+ CONST char *faceName, int *numNamesPtr));
+static char ** ListFontOrAlias _ANSI_ARGS_((Display *display,
+ CONST char *faceName, int *numNamesPtr));
+static unsigned int RankAttributes _ANSI_ARGS_((FontAttributes *wantPtr,
+ FontAttributes *gotPtr));
+static void ReleaseFont _ANSI_ARGS_((UnixFont *fontPtr));
+static void ReleaseSubFont _ANSI_ARGS_((Display *display,
+ SubFont *subFontPtr));
+static int SeenName _ANSI_ARGS_((CONST char *name,
+ Tcl_DString *dsPtr));
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * TkpFontPkgInit --
+ *
+ * This procedure is called when an application is created. It
+ * initializes all the structures that are used by the
+ * platform-dependent code on a per application basis.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
-static UnixFont * AllocFont _ANSI_ARGS_((TkFont *tkFontPtr,
- Tk_Window tkwin, XFontStruct *fontStructPtr,
- CONST char *fontName));
-static void DrawChars _ANSI_ARGS_((Display *display,
- Drawable drawable, GC gc, UnixFont *fontPtr,
- CONST char *source, int numChars, int x,
- int y));
-static int GetControlCharSubst _ANSI_ARGS_((int c, char buf[4]));
+void
+TkpFontPkgInit(mainPtr)
+ TkMainInfo *mainPtr; /* The application being created. */
+{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_EncodingType type;
+ SubFont dummy;
+ int i;
+
+ if (tsdPtr->controlFamily.encoding == NULL) {
+ type.encodingName = "X11ControlChars";
+ type.toUtfProc = ControlUtfProc;
+ type.fromUtfProc = ControlUtfProc;
+ type.freeProc = NULL;
+ type.clientData = NULL;
+ type.nullSize = 0;
+
+ tsdPtr->controlFamily.refCount = 2;
+ tsdPtr->controlFamily.encoding = Tcl_CreateEncoding(&type);
+ tsdPtr->controlFamily.isTwoByteFont = 0;
+
+ dummy.familyPtr = &tsdPtr->controlFamily;
+ dummy.fontMap = tsdPtr->controlFamily.fontMap;
+ for (i = 0x00; i < 0x20; i++) {
+ FontMapInsert(&dummy, i);
+ FontMapInsert(&dummy, i + 0x80);
+ }
+ }
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * ControlUtfProc --
+ *
+ * Convert from UTF-8 into the ASCII expansion of a control
+ * character.
+ *
+ * Results:
+ * Returns TCL_OK if conversion was successful.
+ *
+ * Side effects:
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+ControlUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen,
+ srcReadPtr, dstWrotePtr, dstCharsPtr)
+ ClientData clientData; /* Not used. */
+ CONST char *src; /* Source string in UTF-8. */
+ int srcLen; /* Source string length in bytes. */
+ int flags; /* Conversion control flags. */
+ Tcl_EncodingState *statePtr;/* Place for conversion routine to store
+ * state information used during a piecewise
+ * conversion. Contents of statePtr are
+ * initialized and/or reset by conversion
+ * routine under control of flags argument. */
+ char *dst; /* Output buffer in which converted string
+ * is stored. */
+ int dstLen; /* The maximum length of output buffer in
+ * bytes. */
+ int *srcReadPtr; /* Filled with the number of bytes from the
+ * source string that were converted. This
+ * may be less than the original source length
+ * if there was a problem converting some
+ * source characters. */
+ int *dstWrotePtr; /* Filled with the number of bytes that were
+ * stored in the output buffer as a result of
+ * the conversion. */
+ int *dstCharsPtr; /* Filled with the number of characters that
+ * correspond to the bytes stored in the
+ * output buffer. */
+{
+ CONST char *srcEnd;
+ char *dstStart, *dstEnd;
+ Tcl_UniChar ch;
+ int result;
+ static char hexChars[] = "0123456789abcdef";
+ static char mapChars[] = {
+ 0, 0, 0, 0, 0, 0, 0,
+ 'a', 'b', 't', 'n', 'v', 'f', 'r'
+ };
+
+ result = TCL_OK;
+
+ srcEnd = src + srcLen;
+
+ dstStart = dst;
+ dstEnd = dst + dstLen - 6;
+
+ for ( ; src < srcEnd; ) {
+ if (dst > dstEnd) {
+ result = TCL_CONVERT_NOSPACE;
+ break;
+ }
+ src += Tcl_UtfToUniChar(src, &ch);
+ dst[0] = '\\';
+ if ((ch < sizeof(mapChars)) && (mapChars[ch] != 0)) {
+ dst[1] = mapChars[ch];
+ dst += 2;
+ } else if (ch < 256) {
+ dst[1] = 'x';
+ dst[2] = hexChars[(ch >> 4) & 0xf];
+ dst[3] = hexChars[ch & 0xf];
+ dst += 4;
+ } else {
+ dst[1] = 'u';
+ dst[2] = hexChars[(ch >> 12) & 0xf];
+ dst[3] = hexChars[(ch >> 8) & 0xf];
+ dst[4] = hexChars[(ch >> 4) & 0xf];
+ dst[5] = hexChars[ch & 0xf];
+ dst += 6;
+ }
+ }
+ *srcReadPtr = src - srcEnd;
+ *dstWrotePtr = dst - dstStart;
+ *dstCharsPtr = dst - dstStart;
+ return result;
+}
/*
*---------------------------------------------------------------------------
@@ -116,24 +407,81 @@ static int GetControlCharSubst _ANSI_ARGS_((int c, char buf[4]));
* the contents of the generic TkFont before calling TkpDeleteFont().
*
* Side effects:
- * None.
+ * Memory allocated.
*
*---------------------------------------------------------------------------
*/
-
+
TkFont *
TkpGetNativeFont(tkwin, name)
Tk_Window tkwin; /* For display where font will be used. */
CONST char *name; /* Platform-specific font name. */
{
+ UnixFont *fontPtr;
XFontStruct *fontStructPtr;
+ FontAttributes fa;
+ CONST char *p;
+ int hasSpace, dashes, hasWild;
+
+ /*
+ * The behavior of X when given a name that isn't an XLFD is unspecified.
+ * For example, Exceed 6 returns a valid font for any random string. This
+ * is awkward since system names have higher priority than the other Tk
+ * font syntaxes. So, we need to perform a quick sanity check on the
+ * name and fail if it looks suspicious. We fail if the name:
+ * - contains a space immediately before a dash
+ * - contains a space, but no '*' characters and fewer than 14 dashes
+ */
+
+ hasSpace = dashes = hasWild = 0;
+ for (p = name; *p != '\0'; p++) {
+ if (*p == ' ') {
+ if (p[1] == '-') {
+ return NULL;
+ }
+ hasSpace = 1;
+ } else if (*p == '-') {
+ dashes++;
+ } else if (*p == '*') {
+ hasWild = 1;
+ }
+ }
+ if ((dashes < 14) && !hasWild && hasSpace) {
+ return NULL;
+ }
fontStructPtr = XLoadQueryFont(Tk_Display(tkwin), name);
if (fontStructPtr == NULL) {
- return NULL;
+ /*
+ * Handle all names that look like XLFDs here. Otherwise, when
+ * TkpGetFontFromAttributes is called from generic code, any
+ * foundry or encoding information specified in the XLFD will have
+ * been parsed out and lost. But make sure we don't have an
+ * "-option value" string since TkFontParseXLFD would return a
+ * false success when attempting to parse it.
+ */
+
+ if (name[0] == '-') {
+ if (name[1] != '*') {
+ char *dash;
+
+ dash = strchr(name + 1, '-');
+ if ((dash == NULL) || (isspace(UCHAR(dash[-1])))) {
+ return NULL;
+ }
+ }
+ } else if (name[0] != '*') {
+ return NULL;
+ }
+ if (TkFontParseXLFD(name, &fa.fa, &fa.xa) != TCL_OK) {
+ return NULL;
+ }
+ fontStructPtr = CreateClosestFont(tkwin, &fa.fa, &fa.xa);
}
+ fontPtr = (UnixFont *) ckalloc(sizeof(UnixFont));
+ InitFont(tkwin, fontStructPtr, fontPtr);
- return (TkFont *) AllocFont(NULL, tkwin, fontStructPtr, name);
+ return (TkFont *) fontPtr;
}
/*
@@ -160,7 +508,7 @@ TkpGetNativeFont(tkwin, name)
* the contents of the generic TkFont before calling TkpDeleteFont().
*
* Side effects:
- * None.
+ * Memory allocated.
*
*---------------------------------------------------------------------------
*/
@@ -173,249 +521,29 @@ TkpGetFontFromAttributes(tkFontPtr, tkwin, faPtr)
* will be released. If NULL, a new TkFont
* structure is allocated. */
Tk_Window tkwin; /* For display where font will be used. */
- CONST TkFontAttributes *faPtr; /* Set of attributes to match. */
+ CONST TkFontAttributes *faPtr;
+ /* Set of attributes to match. */
{
- int numNames, score, i, scaleable, pixelsize, xaPixelsize;
- int bestIdx, bestScore, bestScaleableIdx, bestScaleableScore;
- TkXLFDAttributes xa;
- char buf[256];
UnixFont *fontPtr;
- char **nameList;
+ TkXLFDAttributes xa;
XFontStruct *fontStructPtr;
- CONST char *fmt, *family;
- double d;
-
- family = faPtr->family;
- if (family == NULL) {
- family = "*";
- }
-
- pixelsize = -faPtr->pointsize;
- if (pixelsize < 0) {
- d = -pixelsize * 25.4 / 72;
- d *= WidthOfScreen(Tk_Screen(tkwin));
- d /= WidthMMOfScreen(Tk_Screen(tkwin));
- d += 0.5;
- pixelsize = (int) d;
- }
-
- /*
- * Replace the standard Windows and Mac family names with the names that
- * X likes.
- */
-
- if ((strcasecmp("Times New Roman", family) == 0)
- || (strcasecmp("New York", family) == 0)) {
- family = "Times";
- } else if ((strcasecmp("Courier New", family) == 0)
- || (strcasecmp("Monaco", family) == 0)) {
- family = "Courier";
- } else if ((strcasecmp("Arial", family) == 0)
- || (strcasecmp("Geneva", family) == 0)) {
- family = "Helvetica";
- }
-
- /*
- * First try for the Q&D exact match.
- */
-
-#if 0
- sprintf(buf, "-*-%.200s-%s-%c-normal-*-*-%d-*-*-*-*-iso8859-1", family,
- ((faPtr->weight > TK_FW_NORMAL) ? "bold" : "medium"),
- ((faPtr->slant == TK_FS_ROMAN) ? 'r' :
- (faPtr->slant == TK_FS_ITALIC) ? 'i' : 'o'),
- faPtr->pointsize * 10);
- fontStructPtr = XLoadQueryFont(Tk_Display(tkwin), buf);
-#else
- fontStructPtr = NULL;
-#endif
-
- if (fontStructPtr != NULL) {
- goto end;
- }
- /*
- * Couldn't find exact match. Now fall back to other available
- * physical fonts.
- */
- fmt = "-*-%.240s-*-*-*-*-*-*-*-*-*-*-*-*";
- sprintf(buf, fmt, family);
- nameList = XListFonts(Tk_Display(tkwin), buf, 10000, &numNames);
- if (numNames == 0) {
- /*
- * Try getting some system font.
- */
-
- sprintf(buf, fmt, "fixed");
- nameList = XListFonts(Tk_Display(tkwin), buf, 10000, &numNames);
- if (numNames == 0) {
- getsystem:
- fontStructPtr = XLoadQueryFont(Tk_Display(tkwin), "fixed");
- if (fontStructPtr == NULL) {
- fontStructPtr = XLoadQueryFont(Tk_Display(tkwin), "*");
- if (fontStructPtr == NULL) {
- panic("TkpGetFontFromAttributes: cannot get any font");
- }
- }
- goto end;
- }
- }
-
- /*
- * Inspect each of the XLFDs and pick the one that most closely
- * matches the desired attributes.
- */
-
- bestIdx = 0;
- bestScore = INT_MAX;
- bestScaleableIdx = 0;
- bestScaleableScore = INT_MAX;
-
- for (i = 0; i < numNames; i++) {
- score = 0;
- scaleable = 0;
- if (TkParseXLFD(nameList[i], &xa) != TCL_OK) {
- continue;
- }
- xaPixelsize = -xa.fa.pointsize;
-
- /*
- * Since most people used to use -adobe-* in their XLFDs,
- * preserve the preference for "adobe" foundry. Otherwise
- * some applications looks may change slightly if another foundry
- * is chosen.
- */
-
- if (strcasecmp(xa.foundry, "adobe") != 0) {
- score += 3000;
- }
- if (xa.fa.pointsize == 0) {
- /*
- * A scaleable font is almost always acceptable, but the
- * corresponding bitmapped font would be better.
- */
-
- score += 10;
- scaleable = 1;
- } else {
- /*
- * A font that is too small is better than one that is too
- * big.
- */
-
- if (xaPixelsize > pixelsize) {
- score += (xaPixelsize - pixelsize) * 120;
- } else {
- score += (pixelsize - xaPixelsize) * 100;
- }
- }
-
- score += ABS(xa.fa.weight - faPtr->weight) * 30;
- score += ABS(xa.fa.slant - faPtr->slant) * 25;
- if (xa.slant == TK_FS_OBLIQUE) {
- /*
- * Italic fonts are preferred over oblique. */
-
- score += 4;
- }
-
- if (xa.setwidth != TK_SW_NORMAL) {
- /*
- * The normal setwidth is highly preferred.
- */
- score += 2000;
- }
- if (xa.charset == TK_CS_OTHER) {
- /*
- * The standard character set is highly preferred over
- * foreign languages charsets (because we don't support
- * other languages yet).
- */
- score += 11000;
- }
- if ((xa.charset == TK_CS_NORMAL) && (xa.encoding != 1)) {
- /*
- * The '1' encoding for the characters above 0x7f is highly
- * preferred over the other encodings.
- */
- score += 8000;
- }
-
- if (scaleable) {
- if (score < bestScaleableScore) {
- bestScaleableIdx = i;
- bestScaleableScore = score;
- }
- } else {
- if (score < bestScore) {
- bestIdx = i;
- bestScore = score;
- }
- }
- if (score == 0) {
- break;
- }
- }
-
- /*
- * Now we know which is the closest matching scaleable font and the
- * closest matching bitmapped font. If the scaleable font was a
- * better match, try getting the scaleable font; however, if the
- * scalable font was not actually available in the desired
- * pointsize, fall back to the closest bitmapped font.
- */
+ TkInitXLFDAttributes(&xa);
+ fontStructPtr = CreateClosestFont(tkwin, faPtr, &xa);
- fontStructPtr = NULL;
- if (bestScaleableScore < bestScore) {
- char *str, *rest;
-
- /*
- * Fill in the desired pointsize info for this font.
- */
-
- tryscale:
- str = nameList[bestScaleableIdx];
- for (i = 0; i < XLFD_PIXEL_SIZE - 1; i++) {
- str = strchr(str + 1, '-');
- }
- rest = str;
- for (i = XLFD_PIXEL_SIZE - 1; i < XLFD_REGISTRY; i++) {
- rest = strchr(rest + 1, '-');
- }
- *str = '\0';
- sprintf(buf, "%.240s-*-%d-*-*-*-*-*%s", nameList[bestScaleableIdx],
- pixelsize, rest);
- *str = '-';
- fontStructPtr = XLoadQueryFont(Tk_Display(tkwin), buf);
- bestScaleableScore = INT_MAX;
- }
- if (fontStructPtr == NULL) {
- strcpy(buf, nameList[bestIdx]);
- fontStructPtr = XLoadQueryFont(Tk_Display(tkwin), buf);
- if (fontStructPtr == NULL) {
- /*
- * This shouldn't happen because the font name is one of the
- * names that X gave us to use, but it does anyhow.
- */
-
- if (bestScaleableScore < INT_MAX) {
- goto tryscale;
- } else {
- XFreeFontNames(nameList);
- goto getsystem;
- }
- }
+ fontPtr = (UnixFont *) tkFontPtr;
+ if (fontPtr == NULL) {
+ fontPtr = (UnixFont *) ckalloc(sizeof(UnixFont));
+ } else {
+ ReleaseFont(fontPtr);
}
- XFreeFontNames(nameList);
+ InitFont(tkwin, fontStructPtr, fontPtr);
- end:
- fontPtr = AllocFont(tkFontPtr, tkwin, fontStructPtr, buf);
- fontPtr->font.fa.underline = faPtr->underline;
+ fontPtr->font.fa.underline = faPtr->underline;
fontPtr->font.fa.overstrike = faPtr->overstrike;
return (TkFont *) fontPtr;
}
-
/*
*---------------------------------------------------------------------------
@@ -443,9 +571,7 @@ TkpDeleteFont(tkFontPtr)
UnixFont *fontPtr;
fontPtr = (UnixFont *) tkFontPtr;
-
- XFreeFont(fontPtr->display, fontPtr->fontStructPtr);
- ckfree((char *) fontPtr);
+ ReleaseFont(fontPtr);
}
/*
@@ -457,7 +583,7 @@ TkpDeleteFont(tkFontPtr)
* on the display of the given window.
*
* Results:
- * interp->result is modified to hold a list of all the available
+ * Modifies interp's result object to hold a list of all the available
* font families.
*
* Side effects:
@@ -465,52 +591,80 @@ TkpDeleteFont(tkFontPtr)
*
*---------------------------------------------------------------------------
*/
-
+
void
TkpGetFontFamilies(interp, tkwin)
- Tcl_Interp *interp;
- Tk_Window tkwin;
+ Tcl_Interp *interp; /* Interp to hold result. */
+ Tk_Window tkwin; /* For display to query. */
{
int i, new, numNames;
- char *family, *end, *p;
+ char *family;
Tcl_HashTable familyTable;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
char **nameList;
+ Tcl_Obj *resultPtr, *strPtr;
- Tcl_InitHashTable(&familyTable, TCL_STRING_KEYS);
+ resultPtr = Tcl_GetObjResult(interp);
- nameList = XListFonts(Tk_Display(tkwin), "*", 10000, &numNames);
+ Tcl_InitHashTable(&familyTable, TCL_STRING_KEYS);
+ nameList = ListFonts(Tk_Display(tkwin), "*", &numNames);
for (i = 0; i < numNames; i++) {
- if (nameList[i][0] != '-') {
- continue;
- }
- family = strchr(nameList[i] + 1, '-');
- if (family == NULL) {
- continue;
- }
- family++;
- end = strchr(family, '-');
- if (end == NULL) {
- continue;
- }
- *end = '\0';
- for (p = family; *p != '\0'; p++) {
- if (isupper(UCHAR(*p))) {
- *p = tolower(UCHAR(*p));
- }
- }
+ family = strchr(nameList[i] + 1, '-') + 1;
+ strchr(family, '-')[0] = '\0';
Tcl_CreateHashEntry(&familyTable, family, &new);
}
+ XFreeFontNames(nameList);
hPtr = Tcl_FirstHashEntry(&familyTable, &search);
while (hPtr != NULL) {
- Tcl_AppendElement(interp, Tcl_GetHashKey(&familyTable, hPtr));
+ strPtr = Tcl_NewStringObj(Tcl_GetHashKey(&familyTable, hPtr), -1);
+ Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
hPtr = Tcl_NextHashEntry(&search);
}
Tcl_DeleteHashTable(&familyTable);
- XFreeFontNames(nameList);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * TkpGetSubFonts --
+ *
+ * A function used by the testing package for querying the actual
+ * screen fonts that make up a font object.
+ *
+ * Results:
+ * Modifies interp's result object to hold a list containing the
+ * names of the screen fonts that make up the given font object.
+ *
+ * Side effects:
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+TkpGetSubFonts(interp, tkfont)
+ Tcl_Interp *interp;
+ Tk_Font tkfont;
+{
+ int i;
+ Tcl_Obj *objv[3];
+ Tcl_Obj *resultPtr, *listPtr;
+ UnixFont *fontPtr;
+ FontFamily *familyPtr;
+
+ resultPtr = Tcl_GetObjResult(interp);
+ fontPtr = (UnixFont *) tkfont;
+ for (i = 0; i < fontPtr->numSubFonts; i++) {
+ familyPtr = fontPtr->subFontArray[i].familyPtr;
+ objv[0] = Tcl_NewStringObj(familyPtr->faceName, -1);
+ objv[1] = Tcl_NewStringObj(familyPtr->foundry, -1);
+ objv[2] = Tcl_NewStringObj(Tcl_GetEncodingName(familyPtr->encoding), -1);
+ listPtr = Tcl_NewListObj(3, objv);
+ Tcl_ListObjAppendElement(NULL, resultPtr, listPtr);
+ }
}
/*
@@ -524,7 +678,7 @@ TkpGetFontFamilies(interp, tkwin)
* the characters.
*
* Results:
- * The return value is the number of characters from source that
+ * The return value is the number of bytes from source that
* fit into the span that extends from 0 to maxLength. *lengthPtr is
* filled with the x-coordinate of the right edge of the last
* character that did fit.
@@ -534,18 +688,19 @@ TkpGetFontFamilies(interp, tkwin)
*
*---------------------------------------------------------------------------
*/
+
int
-Tk_MeasureChars(tkfont, source, numChars, maxLength, flags, lengthPtr)
+Tk_MeasureChars(tkfont, source, numBytes, maxLength, flags, lengthPtr)
Tk_Font tkfont; /* Font in which characters will be drawn. */
- CONST char *source; /* Characters to be displayed. Need not be
+ CONST char *source; /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
- int numChars; /* Maximum number of characters to consider
+ int numBytes; /* Maximum number of bytes to consider
* from source string. */
- int maxLength; /* If > 0, maxLength specifies the longest
- * permissible line length; don't consider any
- * character that would cross this
- * x-position. If <= 0, then line length is
- * unbounded and the flags argument is
+ int maxLength; /* If >= 0, maxLength specifies the longest
+ * permissible line length in pixels; don't
+ * consider any character that would cross
+ * this x-position. If < 0, then line length
+ * is unbounded and the flags argument is
* ignored. */
int flags; /* Various flag bits OR-ed together:
* TK_PARTIAL_OK means include the last char
@@ -558,99 +713,179 @@ Tk_MeasureChars(tkfont, source, numChars, maxLength, flags, lengthPtr)
* terminating character. */
{
UnixFont *fontPtr;
- CONST char *p; /* Current character. */
- CONST char *term; /* Pointer to most recent character that
- * may legally be a terminating character. */
- int termX; /* X-position just after term. */
- int curX; /* X-position corresponding to p. */
- int newX; /* X-position corresponding to p+1. */
- int c, sawNonSpace;
+ SubFont *lastSubFontPtr;
+ int curX, curByte;
- fontPtr = (UnixFont *) tkfont;
+ /*
+ * Unix does not use kerning or fractional character widths when
+ * displaying text on the screen. So that means we can safely measure
+ * individual characters or spans of characters and add up the widths
+ * w/o any "off-by-one-pixel" errors.
+ */
- if (numChars == 0) {
- *lengthPtr = 0;
- return 0;
- }
+ fontPtr = (UnixFont *) tkfont;
- if (maxLength <= 0) {
- maxLength = INT_MAX;
- }
+ lastSubFontPtr = &fontPtr->subFontArray[0];
- newX = curX = termX = 0;
- p = term = source;
- sawNonSpace = !isspace(UCHAR(*p));
+ if (numBytes == 0) {
+ curX = 0;
+ curByte = 0;
+ } else if (maxLength < 0) {
+ CONST char *p, *end, *next;
+ Tcl_UniChar ch;
+ SubFont *thisSubFontPtr;
+ FontFamily *familyPtr;
+ Tcl_DString runString;
- /*
- * Scan the input string one character at a time, calculating width.
- */
+ /*
+ * A three step process:
+ * 1. Find a contiguous range of characters that can all be
+ * represented by a single screen font.
+ * 2. Convert those chars to the encoding of that font.
+ * 3. Measure converted chars.
+ */
- for (c = UCHAR(*p); ; ) {
- newX += fontPtr->widths[c];
- if (newX > maxLength) {
- break;
+ curX = 0;
+ end = source + numBytes;
+ for (p = source; p < end; ) {
+ next = p + Tcl_UtfToUniChar(p, &ch);
+ thisSubFontPtr = FindSubFontForChar(fontPtr, ch);
+ if (thisSubFontPtr != lastSubFontPtr) {
+ familyPtr = lastSubFontPtr->familyPtr;
+ Tcl_UtfToExternalDString(familyPtr->encoding, source,
+ p - source, &runString);
+ if (familyPtr->isTwoByteFont) {
+ curX += XTextWidth16(lastSubFontPtr->fontStructPtr,
+ (XChar2b *) Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString) / 2);
+ } else {
+ curX += XTextWidth(lastSubFontPtr->fontStructPtr,
+ Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString));
+ }
+ Tcl_DStringFree(&runString);
+ lastSubFontPtr = thisSubFontPtr;
+ source = p;
+ }
+ p = next;
}
- curX = newX;
- numChars--;
- p++;
- if (numChars == 0) {
- term = p;
- termX = curX;
- break;
+ familyPtr = lastSubFontPtr->familyPtr;
+ Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source,
+ &runString);
+ if (familyPtr->isTwoByteFont) {
+ curX += XTextWidth16(lastSubFontPtr->fontStructPtr,
+ (XChar2b *) Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString) >> 1);
+ } else {
+ curX += XTextWidth(lastSubFontPtr->fontStructPtr,
+ Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString));
}
+ Tcl_DStringFree(&runString);
+ curByte = numBytes;
+ } else {
+ CONST char *p, *end, *next, *term;
+ int newX, termX, sawNonSpace, dstWrote;
+ Tcl_UniChar ch;
+ FontFamily *familyPtr;
+ char buf[16];
+
+ /*
+ * How many chars will fit in the space allotted?
+ * This first version may be inefficient because it measures
+ * every character individually.
+ */
- c = UCHAR(*p);
- if (isspace(c)) {
- if (sawNonSpace) {
- term = p;
+ next = source + Tcl_UtfToUniChar(source, &ch);
+ newX = curX = termX = 0;
+
+ term = source;
+ end = source + numBytes;
+
+ sawNonSpace = (ch > 255) || !isspace(ch);
+ familyPtr = lastSubFontPtr->familyPtr;
+ for (p = source; ; ) {
+ if ((ch < BASE_CHARS) && (fontPtr->widths[ch] != 0)) {
+ newX += fontPtr->widths[ch];
+ } else {
+ lastSubFontPtr = FindSubFontForChar(fontPtr, ch);
+ familyPtr = lastSubFontPtr->familyPtr;
+ Tcl_UtfToExternal(NULL, familyPtr->encoding, p, next - p,
+ 0, NULL, buf, sizeof(buf), NULL, &dstWrote, NULL);
+ if (familyPtr->isTwoByteFont) {
+ newX += XTextWidth16(lastSubFontPtr->fontStructPtr,
+ (XChar2b *) buf, dstWrote >> 1);
+ } else {
+ newX += XTextWidth(lastSubFontPtr->fontStructPtr, buf,
+ dstWrote);
+ }
+ }
+ if (newX > maxLength) {
+ break;
+ }
+ curX = newX;
+ p = next;
+ if (p >= end) {
+ term = end;
termX = curX;
- sawNonSpace = 0;
+ break;
}
- } else {
- sawNonSpace = 1;
- }
- }
- /*
- * P points to the first character that doesn't fit in the desired
- * span. Use the flags to figure out what to return.
- */
+ next += Tcl_UtfToUniChar(next, &ch);
+ if ((ch < 256) && isspace(ch)) {
+ if (sawNonSpace) {
+ term = p;
+ termX = curX;
+ sawNonSpace = 0;
+ }
+ } else {
+ sawNonSpace = 1;
+ }
+ }
- if ((flags & TK_PARTIAL_OK) && (numChars > 0) && (curX < maxLength)) {
/*
- * Include the first character that didn't quite fit in the desired
- * span. The width returned will include the width of that extra
- * character.
+ * P points to the first character that doesn't fit in the desired
+ * span. Use the flags to figure out what to return.
*/
- numChars--;
- curX = newX;
- p++;
- }
- if ((flags & TK_AT_LEAST_ONE) && (term == source) && (numChars > 0)) {
- term = p;
- termX = curX;
- if (term == source) {
- term++;
- termX = newX;
+ if ((flags & TK_PARTIAL_OK) && (p < end) && (curX < maxLength)) {
+ /*
+ * Include the first character that didn't quite fit in the desired
+ * span. The width returned will include the width of that extra
+ * character.
+ */
+
+ curX = newX;
+ p += Tcl_UtfToUniChar(p, &ch);
}
- } else if ((numChars == 0) || !(flags & TK_WHOLE_WORDS)) {
- term = p;
- termX = curX;
+ if ((flags & TK_AT_LEAST_ONE) && (term == source) && (p < end)) {
+ term = p;
+ termX = curX;
+ if (term == source) {
+ term += Tcl_UtfToUniChar(term, &ch);
+ termX = newX;
+ }
+ } else if ((p >= end) || !(flags & TK_WHOLE_WORDS)) {
+ term = p;
+ termX = curX;
+ }
+
+ curX = termX;
+ curByte = term - source;
}
- *lengthPtr = termX;
- return term-source;
+ *lengthPtr = curX;
+ return curByte;
}
/*
*---------------------------------------------------------------------------
*
- * Tk_DrawChars, DrawChars --
+ * Tk_DrawChars --
*
* Draw a string of characters on the screen. Tk_DrawChars()
- * expands control characters that occur in the string to \X or
- * \xXX sequences. DrawChars() just draws the strings.
+ * expands control characters that occur in the string to
+ * \xNN sequences.
*
* Results:
* None.
@@ -662,255 +897,359 @@ Tk_MeasureChars(tkfont, source, numChars, maxLength, flags, lengthPtr)
*/
void
-Tk_DrawChars(display, drawable, gc, tkfont, source, numChars, x, y)
+Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y)
Display *display; /* Display on which to draw. */
Drawable drawable; /* Window or pixmap in which to draw. */
GC gc; /* Graphics context for drawing characters. */
Tk_Font tkfont; /* Font in which characters will be drawn;
* must be the same as font used in GC. */
- CONST char *source; /* Characters to be displayed. Need not be
+ CONST char *source; /* UTF-8 string to be displayed. Need not be
* '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
* is passed to this function. If they are
* not stripped out, they will be displayed as
* regular printing characters. */
- int numChars; /* Number of characters in string. */
+ int numBytes; /* Number of bytes in string. */
int x, y; /* Coordinates at which to place origin of
* string when drawing. */
{
UnixFont *fontPtr;
- CONST char *p;
- int i, type;
- char buf[4];
+ SubFont *thisSubFontPtr, *lastSubFontPtr;
+ Tcl_DString runString;
+ CONST char *p, *end, *next;
+ int xStart, needWidth;
+ Tcl_UniChar ch;
+ FontFamily *familyPtr;
fontPtr = (UnixFont *) tkfont;
-
- p = source;
- for (i = 0; i < numChars; i++) {
- type = fontPtr->types[UCHAR(*p)];
- if (type != NORMAL) {
- DrawChars(display, drawable, gc, fontPtr, source, p - source, x, y);
- x += XTextWidth(fontPtr->fontStructPtr, source, p - source);
- if (type == REPLACE) {
- DrawChars(display, drawable, gc, fontPtr, buf,
- GetControlCharSubst(UCHAR(*p), buf), x, y);
- x += fontPtr->widths[UCHAR(*p)];
+ lastSubFontPtr = &fontPtr->subFontArray[0];
+
+ xStart = x;
+
+ end = source + numBytes;
+ for (p = source; p < end; ) {
+ next = p + Tcl_UtfToUniChar(p, &ch);
+ thisSubFontPtr = FindSubFontForChar(fontPtr, ch);
+ if (thisSubFontPtr != lastSubFontPtr) {
+ if (p > source) {
+ familyPtr = lastSubFontPtr->familyPtr;
+ Tcl_UtfToExternalDString(familyPtr->encoding, source,
+ p - source, &runString);
+ if (familyPtr->isTwoByteFont) {
+ XDrawString16(display, drawable, gc, x, y,
+ (XChar2b *) Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString) / 2);
+
+ x += XTextWidth16(lastSubFontPtr->fontStructPtr,
+ (XChar2b *) Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString) / 2);
+ } else {
+ XDrawString(display, drawable, gc, x, y,
+ Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString));
+ x += XTextWidth(lastSubFontPtr->fontStructPtr,
+ Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString));
+ }
+ Tcl_DStringFree(&runString);
}
- source = p + 1;
+ lastSubFontPtr = thisSubFontPtr;
+ source = p;
+ XSetFont(display, gc, lastSubFontPtr->fontStructPtr->fid);
}
- p++;
+ p = next;
}
- DrawChars(display, drawable, gc, fontPtr, source, p - source, x, y);
-}
-
-static void
-DrawChars(display, drawable, gc, fontPtr, source, numChars, x, y)
- Display *display; /* Display on which to draw. */
- Drawable drawable; /* Window or pixmap in which to draw. */
- GC gc; /* Graphics context for drawing characters. */
- UnixFont *fontPtr; /* Font in which characters will be drawn;
- * must be the same as font used in GC. */
- CONST char *source; /* Characters to be displayed. Need not be
- * '\0' terminated. All Tk meta-characters
- * (tabs, control characters, and newlines)
- * should be stripped out of the string that
- * is passed to this function. If they are
- * not stripped out, they will be displayed as
- * regular printing characters. */
- int numChars; /* Number of characters in string. */
- int x, y; /* Coordinates at which to place origin of
- * string when drawing. */
-{
- /*
- * Perform a quick sanity check to ensure we won't overflow the X
- * coordinate space.
- */
-
- if ((x + (fontPtr->fontStructPtr->max_bounds.width * numChars) > 0x7fff)) {
- int length;
-
- /*
- * The string we are being asked to draw is too big and would overflow
- * the X coordinate space. Unfortunatley X servers aren't too bright
- * and so they won't deal with this case cleanly. We need to truncate
- * the string before sending it to X.
- */
-
- numChars = Tk_MeasureChars((Tk_Font) fontPtr, source, numChars,
- 0x7fff - x, 0, &length);
+ needWidth = fontPtr->font.fa.underline + fontPtr->font.fa.overstrike;
+ if (p > source) {
+ familyPtr = lastSubFontPtr->familyPtr;
+ Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source,
+ &runString);
+ if (familyPtr->isTwoByteFont) {
+ XDrawString16(display, drawable, gc, x, y,
+ (XChar2b *) Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString) >> 1);
+ if (needWidth) {
+ x += XTextWidth16(lastSubFontPtr->fontStructPtr,
+ (XChar2b *) Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString) >> 1);
+ }
+ } else {
+ XDrawString(display, drawable, gc, x, y,
+ Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString));
+ if (needWidth) {
+ x += XTextWidth(lastSubFontPtr->fontStructPtr,
+ Tcl_DStringValue(&runString),
+ Tcl_DStringLength(&runString));
+ }
+ }
+ Tcl_DStringFree(&runString);
}
- XDrawString(display, drawable, gc, x, y, source, numChars);
+ if (lastSubFontPtr != &fontPtr->subFontArray[0]) {
+ XSetFont(display, gc, fontPtr->subFontArray[0].fontStructPtr->fid);
+ }
if (fontPtr->font.fa.underline != 0) {
- XFillRectangle(display, drawable, gc, x,
+ XFillRectangle(display, drawable, gc, xStart,
y + fontPtr->underlinePos,
- (unsigned) XTextWidth(fontPtr->fontStructPtr, source, numChars),
- (unsigned) fontPtr->barHeight);
+ (unsigned) (x - xStart), (unsigned) fontPtr->barHeight);
}
if (fontPtr->font.fa.overstrike != 0) {
y -= fontPtr->font.fm.descent + (fontPtr->font.fm.ascent) / 10;
- XFillRectangle(display, drawable, gc, x, y,
- (unsigned) XTextWidth(fontPtr->fontStructPtr, source, numChars),
- (unsigned) fontPtr->barHeight);
+ XFillRectangle(display, drawable, gc, xStart, y,
+ (unsigned) (x - xStart), (unsigned) fontPtr->barHeight);
}
}
/*
- *---------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*
- * AllocFont --
+ * CreateClosestFont --
*
* Helper for TkpGetNativeFont() and TkpGetFontFromAttributes().
- * Allocates and intializes the memory for a new TkFont that
- * wraps the platform-specific data.
+ * Given a set of font attributes, construct a close XFontStruct.
+ * If requested face name is not available, automatically
+ * substitutes an alias for requested face name. If encoding is
+ * not specified (or the requested one is not available),
+ * automatically chooses another encoding from the list of
+ * preferred encodings. If the foundry is not specified (or
+ * is not available) automatically prefers "adobe" foundry.
+ * For all other attributes, if the requested value was not
+ * available, the appropriate "close" value will be used.
*
* Results:
- * Returns pointer to newly constructed TkFont.
- *
- * The caller is responsible for initializing the fields of the
- * TkFont that are used exclusively by the generic TkFont code, and
- * for releasing those fields before calling TkpDeleteFont().
+ * Return value is the XFontStruct that best matched the
+ * requested attributes. The return value is never NULL; some
+ * font will always be returned.
*
* Side effects:
- * Memory allocated.
+ * None.
*
- *---------------------------------------------------------------------------
- */
+ *-------------------------------------------------------------------------
+ */
-static UnixFont *
-AllocFont(tkFontPtr, tkwin, fontStructPtr, fontName)
- TkFont *tkFontPtr; /* If non-NULL, store the information in
- * this existing TkFont structure, rather than
- * allocating a new structure to hold the
- * font; the existing contents of the font
- * will be released. If NULL, a new TkFont
- * structure is allocated. */
+static XFontStruct *
+CreateClosestFont(tkwin, faPtr, xaPtr)
Tk_Window tkwin; /* For display where font will be used. */
- XFontStruct *fontStructPtr; /* X information about font. */
- CONST char *fontName; /* The string passed to XLoadQueryFont() to
- * construct the fontStructPtr. */
+ CONST TkFontAttributes *faPtr;
+ /* Set of generic attributes to match. */
+ CONST TkXLFDAttributes *xaPtr;
+ /* Set of X-specific attributes to match. */
{
- UnixFont *fontPtr;
- unsigned long value;
- int i, width, firstChar, lastChar, n, replaceOK;
- char *name, *p;
- char buf[4];
- TkXLFDAttributes xa;
- double d;
-
- if (tkFontPtr != NULL) {
- fontPtr = (UnixFont *) tkFontPtr;
- XFreeFont(fontPtr->display, fontPtr->fontStructPtr);
- } else {
- fontPtr = (UnixFont *) ckalloc(sizeof(UnixFont));
+ FontAttributes want;
+ char **nameList;
+ int numNames, nameIdx;
+ Display *display;
+ XFontStruct *fontStructPtr;
+ int bestIdx[2];
+ unsigned int bestScore[2];
+
+ want.fa = *faPtr;
+ want.xa = *xaPtr;
+
+ if (want.xa.foundry == NULL) {
+ want.xa.foundry = Tk_GetUid("adobe");
+ }
+ if (want.fa.family == NULL) {
+ want.fa.family = Tk_GetUid("fixed");
}
+ want.fa.size = -TkFontGetPixels(tkwin, faPtr->size);
+ if (want.xa.charset == NULL || *want.xa.charset == '\0') {
+ want.xa.charset = Tk_GetUid("iso8859-1"); /* locale. */
+ }
+
+ display = Tk_Display(tkwin);
/*
- * Encapsulate the generic stuff in the TkFont.
+ * Algorithm to get the closest font to the name requested.
+ *
+ * try fontname
+ * try all aliases for fontname
+ * foreach fallback for fontname
+ * try the fallback
+ * try all aliases for the fallback
*/
- fontPtr->font.fid = fontStructPtr->fid;
-
- if (XGetFontProperty(fontStructPtr, XA_FONT, &value) && (value != 0)) {
- name = Tk_GetAtomName(tkwin, (Atom) value);
- TkInitFontAttributes(&xa.fa);
- if (TkParseXLFD(name, &xa) == TCL_OK) {
- goto ok;
+ nameList = ListFontOrAlias(display, want.fa.family, &numNames);
+ if (numNames == 0) {
+ char ***fontFallbacks;
+ int i, j;
+ char *fallback;
+
+ fontFallbacks = TkFontGetFallbacks();
+ for (i = 0; fontFallbacks[i] != NULL; i++) {
+ for (j = 0; (fallback = fontFallbacks[i][j]) != NULL; j++) {
+ if (strcasecmp(want.fa.family, fallback) == 0) {
+ break;
+ }
+ }
+ if (fallback != NULL) {
+ for (j = 0; (fallback = fontFallbacks[i][j]) != NULL; j++) {
+ nameList = ListFontOrAlias(display, fallback, &numNames);
+ if (numNames != 0) {
+ goto found;
+ }
+ }
+ }
+ }
+ nameList = ListFonts(display, "fixed", &numNames);
+ if (numNames == 0) {
+ nameList = ListFonts(display, "*", &numNames);
+ }
+ if (numNames == 0) {
+ return GetSystemFont(display);
}
}
- TkInitFontAttributes(&xa.fa);
- if (TkParseXLFD(fontName, &xa) != TCL_OK) {
- TkInitFontAttributes(&fontPtr->font.fa);
- fontPtr->font.fa.family = Tk_GetUid(fontName);
- } else {
- ok:
- fontPtr->font.fa = xa.fa;
+ found:
+ bestIdx[0] = -1;
+ bestIdx[1] = -1;
+ bestScore[0] = (unsigned int) -1;
+ bestScore[1] = (unsigned int) -1;
+ for (nameIdx = 0; nameIdx < numNames; nameIdx++) {
+ FontAttributes got;
+ int scalable;
+ unsigned int score;
+
+ if (TkFontParseXLFD(nameList[nameIdx], &got.fa, &got.xa) != TCL_OK) {
+ continue;
+ }
+ IdentifySymbolEncodings(&got);
+ scalable = (got.fa.size == 0);
+ score = RankAttributes(&want, &got);
+ if (score <= bestScore[scalable]) {
+ bestIdx[scalable] = nameIdx;
+ bestScore[scalable] = score;
+ }
+ if (score == 0) {
+ break;
+ }
}
- if (fontPtr->font.fa.pointsize < 0) {
- d = -fontPtr->font.fa.pointsize * 72 / 25.4;
- d *= WidthMMOfScreen(Tk_Screen(tkwin));
- d /= WidthOfScreen(Tk_Screen(tkwin));
- d += 0.5;
- fontPtr->font.fa.pointsize = (int) d;
+ fontStructPtr = GetScreenFont(display, &want, nameList, bestIdx, bestScore);
+ XFreeFontNames(nameList);
+
+ if (fontStructPtr == NULL) {
+ return GetSystemFont(display);
}
-
- fontPtr->font.fm.ascent = fontStructPtr->ascent;
- fontPtr->font.fm.descent = fontStructPtr->descent;
- fontPtr->font.fm.maxWidth = fontStructPtr->max_bounds.width;
- fontPtr->font.fm.fixed = 1;
- fontPtr->display = Tk_Display(tkwin);
- fontPtr->fontStructPtr = fontStructPtr;
+ return fontStructPtr;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * InitFont --
+ *
+ * Helper for TkpGetNativeFont() and TkpGetFontFromAttributes().
+ * Initializes the memory for a new UnixFont that wraps the
+ * platform-specific data.
+ *
+ * The caller is responsible for initializing the fields of the
+ * TkFont that are used exclusively by the generic TkFont code, and
+ * for releasing those fields before calling TkpDeleteFont().
+ *
+ * Results:
+ * Fills the WinFont structure.
+ *
+ * Side effects:
+ * Memory allocated.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+InitFont(tkwin, fontStructPtr, fontPtr)
+ Tk_Window tkwin; /* For screen where font will be used. */
+ XFontStruct *fontStructPtr; /* X information about font. */
+ UnixFont *fontPtr; /* Filled with information constructed from
+ * the above arguments. */
+{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ unsigned long value;
+ int minHi, maxHi, minLo, maxLo, fixed, width, limit, i, n;
+ FontAttributes fa;
+ TkFontAttributes *faPtr;
+ TkFontMetrics *fmPtr;
+ SubFont *controlPtr, *subFontPtr;
+ char *pageMap;
+ Display *display;
/*
- * Classify the characters.
+ * Get all font attributes and metrics.
*/
-
- firstChar = fontStructPtr->min_char_or_byte2;
- lastChar = fontStructPtr->max_char_or_byte2;
- for (i = 0; i < 256; i++) {
- if ((i == 0177) || (i < firstChar) || (i > lastChar)) {
- fontPtr->types[i] = REPLACE;
- } else {
- fontPtr->types[i] = NORMAL;
+
+ display = Tk_Display(tkwin);
+ GetFontAttributes(display, fontStructPtr, &fa);
+
+ minHi = fontStructPtr->min_byte1;
+ maxHi = fontStructPtr->max_byte1;
+ minLo = fontStructPtr->min_char_or_byte2;
+ maxLo = fontStructPtr->max_char_or_byte2;
+
+ fixed = 1;
+ if (fontStructPtr->per_char != NULL) {
+ width = 0;
+ limit = (maxHi - minHi + 1) * (maxLo - minLo + 1);
+ for (i = 0; i < limit; i++) {
+ n = fontStructPtr->per_char[i].width;
+ if (n != 0) {
+ if (width == 0) {
+ width = n;
+ } else if (width != n) {
+ fixed = 0;
+ break;
+ }
+ }
}
}
- /*
- * Compute the widths for all the normal characters. Any other
- * characters are given an initial width of 0. Also, this determines
- * if this is a fixed or variable width font, by comparing the widths
- * of all the normal characters.
- */
-
- width = 0;
+ fontPtr->font.fid = fontStructPtr->fid;
+
+ faPtr = &fontPtr->font.fa;
+ faPtr->family = fa.fa.family;
+ faPtr->size = TkFontGetPoints(tkwin, fa.fa.size);
+ faPtr->weight = fa.fa.weight;
+ faPtr->slant = fa.fa.slant;
+ faPtr->underline = 0;
+ faPtr->overstrike = 0;
+
+ fmPtr = &fontPtr->font.fm;
+ fmPtr->ascent = fontStructPtr->ascent;
+ fmPtr->descent = fontStructPtr->descent;
+ fmPtr->maxWidth = fontStructPtr->max_bounds.width;
+ fmPtr->fixed = fixed;
+
+ fontPtr->display = display;
+ fontPtr->pixelSize = TkFontGetPixels(tkwin, fa.fa.size);
+ fontPtr->xa = fa.xa;
+
+ fontPtr->numSubFonts = 1;
+ fontPtr->subFontArray = fontPtr->staticSubFonts;
+ InitSubFont(display, fontStructPtr, 1, &fontPtr->subFontArray[0]);
+
+ fontPtr->controlSubFont = fontPtr->subFontArray[0];
+ subFontPtr = FindSubFontForChar(fontPtr, '0');
+ controlPtr = &fontPtr->controlSubFont;
+ controlPtr->fontStructPtr = subFontPtr->fontStructPtr;
+ controlPtr->familyPtr = &tsdPtr->controlFamily;
+ controlPtr->fontMap = tsdPtr->controlFamily.fontMap;
+
+ pageMap = fontPtr->subFontArray[0].fontMap[0];
for (i = 0; i < 256; i++) {
- if (fontPtr->types[i] != NORMAL) {
+ if ((minHi > 0) || (i < minLo) || (i > maxLo) ||
+ (((pageMap[i >> 3] >> (i & 7)) & 1) == 0)) {
n = 0;
} else if (fontStructPtr->per_char == NULL) {
n = fontStructPtr->max_bounds.width;
} else {
- n = fontStructPtr->per_char[i - firstChar].width;
+ n = fontStructPtr->per_char[i - minLo].width;
}
fontPtr->widths[i] = n;
- if (n != 0) {
- if (width == 0) {
- width = n;
- } else if (width != n) {
- fontPtr->font.fm.fixed = 0;
- }
- }
- }
-
- /*
- * Compute the widths of the characters that should be replaced with
- * control character expansions. If the appropriate chars are not
- * available in this font, then control character expansions will not
- * be used; control chars will be invisible & zero-width.
- */
-
- replaceOK = 1;
- for (p = hexChars; *p != '\0'; p++) {
- if ((UCHAR(*p) < firstChar) || (UCHAR(*p) > lastChar)) {
- replaceOK = 0;
- break;
- }
- }
- for (i = 0; i < 256; i++) {
- if (fontPtr->types[i] == REPLACE) {
- if (replaceOK) {
- n = GetControlCharSubst(i, buf);
- for ( ; --n >= 0; ) {
- fontPtr->widths[i] += fontPtr->widths[UCHAR(buf[n])];
- }
- } else {
- fontPtr->types[i] = SKIP;
- }
- }
}
+
if (XGetFontProperty(fontStructPtr, XA_UNDERLINE_POSITION, &value)) {
fontPtr->underlinePos = value;
@@ -924,9 +1263,6 @@ AllocFont(tkFontPtr, tkwin, fontStructPtr, fontName)
}
fontPtr->barHeight = 0;
if (XGetFontProperty(fontStructPtr, XA_UNDERLINE_THICKNESS, &value)) {
- /*
- * Sometimes this is 0 even though it shouldn't be.
- */
fontPtr->barHeight = value;
}
if (fontPtr->barHeight == 0) {
@@ -955,23 +1291,627 @@ AllocFont(tkFontPtr, tkwin, fontStructPtr, fontName)
fontPtr->barHeight = 1;
}
}
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * ReleaseFont --
+ *
+ * Called to release the unix-specific contents of a TkFont.
+ * The caller is responsible for freeing the memory used by the
+ * font itself.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Memory is freed.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+ReleaseFont(fontPtr)
+ UnixFont *fontPtr; /* The font to delete. */
+{
+ int i;
+
+ for (i = 0; i < fontPtr->numSubFonts; i++) {
+ ReleaseSubFont(fontPtr->display, &fontPtr->subFontArray[i]);
+ }
+ if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
+ ckfree((char *) fontPtr->subFontArray);
+ }
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * InitSubFont --
+ *
+ * Wrap a screen font and load the FontFamily that represents
+ * it. Used to prepare a SubFont so that characters can be mapped
+ * from UTF-8 to the charset of the font.
+ *
+ * Results:
+ * The subFontPtr is filled with information about the font.
+ *
+ * Side effects:
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
- return fontPtr;
+static void
+InitSubFont(display, fontStructPtr, base, subFontPtr)
+ Display *display; /* Display in which font will be used. */
+ XFontStruct *fontStructPtr; /* The screen font. */
+ int base; /* Non-zero if this SubFont is being used
+ * as the base font for a font object. */
+ SubFont *subFontPtr; /* Filled with SubFont constructed from
+ * above attributes. */
+{
+ subFontPtr->fontStructPtr = fontStructPtr;
+ subFontPtr->familyPtr = AllocFontFamily(display, fontStructPtr, base);
+ subFontPtr->fontMap = subFontPtr->familyPtr->fontMap;
}
/*
+ *-------------------------------------------------------------------------
+ *
+ * ReleaseSubFont --
+ *
+ * Called to release the contents of a SubFont. The caller is
+ * responsible for freeing the memory used by the SubFont itself.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Memory and resources are freed.
+ *
*---------------------------------------------------------------------------
+ */
+
+static void
+ReleaseSubFont(display, subFontPtr)
+ Display *display; /* Display which owns screen font. */
+ SubFont *subFontPtr; /* The SubFont to delete. */
+{
+ XFreeFont(display, subFontPtr->fontStructPtr);
+ FreeFontFamily(subFontPtr->familyPtr);
+}
+
+/*
+ *-------------------------------------------------------------------------
*
- * GetControlCharSubst --
+ * AllocFontFamily --
*
- * When displaying text in a widget, a backslashed escape sequence
- * is substituted for control characters that occur in the text.
- * Given a control character, fill in a buffer with the replacement
- * string that should be displayed.
+ * Find the FontFamily structure associated with the given font
+ * name. The information should be stored by the caller in a
+ * SubFont and used when determining if that SubFont supports a
+ * character.
+ *
+ * Cannot use the string name used to construct the font as the
+ * key, because the capitalization may not be canonical. Therefore
+ * use the face name actually retrieved from the font metrics as
+ * the key.
*
* Results:
- * The return value is the length of the substitute string. buf is
- * filled with the substitute string; it is not '\0' terminated.
+ * A pointer to a FontFamily. The reference count in the FontFamily
+ * is automatically incremented. When the SubFont is released, the
+ * reference count is decremented. When no SubFont is using this
+ * FontFamily, it may be deleted.
+ *
+ * Side effects:
+ * A new FontFamily structure will be allocated if this font family
+ * has not been seen. TrueType character existence metrics are
+ * loaded into the FontFamily structure.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static FontFamily *
+AllocFontFamily(display, fontStructPtr, base)
+ Display *display; /* Display in which font will be used. */
+ XFontStruct *fontStructPtr; /* Screen font whose FontFamily is to be
+ * returned. */
+ int base; /* Non-zero if this font family is to be
+ * used in the base font of a font object. */
+{
+ FontFamily *familyPtr;
+ FontAttributes fa;
+ Tcl_Encoding encoding;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ GetFontAttributes(display, fontStructPtr, &fa);
+ encoding = Tcl_GetEncoding(NULL, GetEncodingAlias(fa.xa.charset));
+
+ familyPtr = tsdPtr->fontFamilyList;
+ for (; familyPtr != NULL; familyPtr = familyPtr->nextPtr) {
+ if ((familyPtr->faceName == fa.fa.family)
+ && (familyPtr->foundry == fa.xa.foundry)
+ && (familyPtr->encoding == encoding)) {
+ Tcl_FreeEncoding(encoding);
+ familyPtr->refCount++;
+ return familyPtr;
+ }
+ }
+
+ familyPtr = (FontFamily *) ckalloc(sizeof(FontFamily));
+ memset(familyPtr, 0, sizeof(FontFamily));
+ familyPtr->nextPtr = tsdPtr->fontFamilyList;
+ tsdPtr->fontFamilyList = familyPtr;
+
+ /*
+ * Set key for this FontFamily.
+ */
+
+ familyPtr->foundry = fa.xa.foundry;
+ familyPtr->faceName = fa.fa.family;
+ familyPtr->encoding = encoding;
+
+ /*
+ * An initial refCount of 2 means that FontFamily information will
+ * persist even when the SubFont that loaded the FontFamily is released.
+ * Change it to 1 to cause FontFamilies to be unloaded when not in use.
+ */
+
+ familyPtr->refCount = 2;
+ familyPtr->isTwoByteFont = (fontStructPtr->min_byte1 > 0);
+ return familyPtr;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * FreeFontFamily --
+ *
+ * Called to free an FontFamily when the SubFont is finished using
+ * it. Frees the contents of the FontFamily and the memory used by
+ * the FontFamily itself.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void
+FreeFontFamily(familyPtr)
+ FontFamily *familyPtr; /* The FontFamily to delete. */
+{
+ FontFamily **familyPtrPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ int i;
+
+ if (familyPtr == NULL) {
+ return;
+ }
+ familyPtr->refCount--;
+ if (familyPtr->refCount > 0) {
+ return;
+ }
+ Tcl_FreeEncoding(familyPtr->encoding);
+ for (i = 0; i < FONTMAP_PAGES; i++) {
+ if (familyPtr->fontMap[i] != NULL) {
+ ckfree(familyPtr->fontMap[i]);
+ }
+ }
+
+ /*
+ * Delete from list.
+ */
+
+ for (familyPtrPtr = &tsdPtr->fontFamilyList; ; ) {
+ if (*familyPtrPtr == familyPtr) {
+ *familyPtrPtr = familyPtr->nextPtr;
+ break;
+ }
+ familyPtrPtr = &(*familyPtrPtr)->nextPtr;
+ }
+
+ ckfree((char *) familyPtr);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * FindSubFontForChar --
+ *
+ * Determine which screen font is necessary to use to
+ * display the given character. If the font object does not have
+ * a screen font that can display the character, another screen font
+ * may be loaded into the font object, following a set of preferred
+ * fallback rules.
+ *
+ * Results:
+ * The return value is the SubFont to use to display the given
+ * character.
+ *
+ * Side effects:
+ * The contents of fontPtr are modified to cache the results
+ * of the lookup and remember any SubFonts that were dynamically
+ * loaded.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static SubFont *
+FindSubFontForChar(fontPtr, ch)
+ UnixFont *fontPtr; /* The font object with which the character
+ * will be displayed. */
+ int ch; /* The Unicode character to be displayed. */
+{
+ int i, j, k, numNames;
+ char *faceName, *fallback;
+ char **aliases, **nameList, **anyFallbacks;
+ char ***fontFallbacks;
+ SubFont *subFontPtr;
+ Tcl_DString ds;
+
+ if (FontMapLookup(&fontPtr->subFontArray[0], ch)) {
+ return &fontPtr->subFontArray[0];
+ }
+
+ for (i = 1; i < fontPtr->numSubFonts; i++) {
+ if (FontMapLookup(&fontPtr->subFontArray[i], ch)) {
+ return &fontPtr->subFontArray[i];
+ }
+ }
+
+ if (FontMapLookup(&fontPtr->controlSubFont, ch)) {
+ return &fontPtr->controlSubFont;
+ }
+
+ /*
+ * Keep track of all face names that we check, so we don't check some
+ * name multiple times if it can be reached by multiple paths.
+ */
+
+ Tcl_DStringInit(&ds);
+
+ /*
+ * Are there any other fonts with the same face name as the base
+ * font that could display this character, e.g., if the base font
+ * is adobe:fixed:iso8859-1, we could might be able to use
+ * misc:fixed:iso8859-8 or sony:fixed:jisx0208.1983-0
+ */
+
+ faceName = fontPtr->font.fa.family;
+ if (SeenName(faceName, &ds) == 0) {
+ subFontPtr = CanUseFallback(fontPtr, faceName, ch);
+ if (subFontPtr != NULL) {
+ goto end;
+ }
+ }
+
+ aliases = TkFontGetAliasList(faceName);
+
+ subFontPtr = NULL;
+ fontFallbacks = TkFontGetFallbacks();
+ for (i = 0; fontFallbacks[i] != NULL; i++) {
+ for (j = 0; (fallback = fontFallbacks[i][j]) != NULL; j++) {
+ if (strcasecmp(fallback, faceName) == 0) {
+ /*
+ * If the base font has a fallback...
+ */
+
+ goto tryfallbacks;
+ } else if (aliases != NULL) {
+ /*
+ * Or if an alias for the base font has a fallback...
+ */
+
+ for (k = 0; aliases[k] != NULL; k++) {
+ if (strcasecmp(fallback, aliases[k]) == 0) {
+ goto tryfallbacks;
+ }
+ }
+ }
+ }
+ continue;
+
+ tryfallbacks:
+
+ /*
+ * ...then see if we can use one of the fallbacks, or an
+ * alias for one of the fallbacks.
+ */
+
+ for (j = 0; (fallback = fontFallbacks[i][j]) != NULL; j++) {
+ subFontPtr = CanUseFallbackWithAliases(fontPtr, fallback, ch, &ds);
+ if (subFontPtr != NULL) {
+ goto end;
+ }
+ }
+ }
+
+ /*
+ * See if we can use something from the global fallback list.
+ */
+
+ anyFallbacks = TkFontGetGlobalClass();
+ for (i = 0; (fallback = anyFallbacks[i]) != NULL; i++) {
+ subFontPtr = CanUseFallbackWithAliases(fontPtr, fallback, ch, &ds);
+ if (subFontPtr != NULL) {
+ goto end;
+ }
+ }
+
+ /*
+ * Try all face names available in the whole system until we
+ * find one that can be used.
+ */
+
+ nameList = ListFonts(fontPtr->display, "*", &numNames);
+ for (i = 0; i < numNames; i++) {
+ fallback = strchr(nameList[i] + 1, '-') + 1;
+ strchr(fallback, '-')[0] = '\0';
+ if (SeenName(fallback, &ds) == 0) {
+ subFontPtr = CanUseFallback(fontPtr, fallback, ch);
+ if (subFontPtr != NULL) {
+ XFreeFontNames(nameList);
+ goto end;
+ }
+ }
+ }
+ XFreeFontNames(nameList);
+
+ end:
+ Tcl_DStringFree(&ds);
+
+ if (subFontPtr == NULL) {
+ /*
+ * No font can display this character, so it will be displayed as a
+ * control character expansion.
+ */
+
+ subFontPtr = &fontPtr->controlSubFont;
+ FontMapInsert(subFontPtr, ch);
+ }
+ return subFontPtr;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * FontMapLookup --
+ *
+ * See if the screen font can display the given character.
+ *
+ * Results:
+ * The return value is 0 if the screen font cannot display the
+ * character, non-zero otherwise.
+ *
+ * Side effects:
+ * New pages are added to the font mapping cache whenever the
+ * character belongs to a page that hasn't been seen before.
+ * When a page is loaded, information about all the characters on
+ * that page is stored, not just for the single character in
+ * question.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static int
+FontMapLookup(subFontPtr, ch)
+ SubFont *subFontPtr; /* Contains font mapping cache to be queried
+ * and possibly updated. */
+ int ch; /* Character to be tested. */
+{
+ int row, bitOffset;
+
+ row = ch >> FONTMAP_SHIFT;
+ if (subFontPtr->fontMap[row] == NULL) {
+ FontMapLoadPage(subFontPtr, row);
+ }
+ bitOffset = ch & (FONTMAP_BITSPERPAGE - 1);
+ return (subFontPtr->fontMap[row][bitOffset >> 3] >> (bitOffset & 7)) & 1;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * FontMapInsert --
+ *
+ * Tell the font mapping cache that the given screen font should be
+ * used to display the specified character. This is called when no
+ * font on the system can be be found that can display that
+ * character; we lie to the font and tell it that it can display
+ * the character, otherwise we would end up re-searching the entire
+ * fallback hierarchy every time that character was seen.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * New pages are added to the font mapping cache whenever the
+ * character belongs to a page that hasn't been seen before.
+ * When a page is loaded, information about all the characters on
+ * that page is stored, not just for the single character in
+ * question.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void
+FontMapInsert(subFontPtr, ch)
+ SubFont *subFontPtr; /* Contains font mapping cache to be
+ * updated. */
+ int ch; /* Character to be added to cache. */
+{
+ int row, bitOffset;
+
+ row = ch >> FONTMAP_SHIFT;
+ if (subFontPtr->fontMap[row] == NULL) {
+ FontMapLoadPage(subFontPtr, row);
+ }
+ bitOffset = ch & (FONTMAP_BITSPERPAGE - 1);
+ subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * FontMapLoadPage --
+ *
+ * Load information about all the characters on a given page.
+ * This information consists of one bit per character that indicates
+ * whether the associated screen font can (1) or cannot (0) display
+ * the characters on the page.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Mempry allocated.
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+FontMapLoadPage(subFontPtr, row)
+ SubFont *subFontPtr; /* Contains font mapping cache to be
+ * updated. */
+ int row; /* Index of the page to be loaded into
+ * the cache. */
+{
+ char src[TCL_UTF_MAX], buf[16];
+ int minHi, maxHi, minLo, maxLo, scale, checkLo;
+ int i, end, bitOffset, isTwoByteFont, n;
+ Tcl_Encoding encoding;
+ XFontStruct *fontStructPtr;
+ XCharStruct *widths;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ subFontPtr->fontMap[row] = (char *) ckalloc(FONTMAP_BITSPERPAGE / 8);
+ memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8);
+
+ if (subFontPtr->familyPtr == &tsdPtr->controlFamily) {
+ return;
+ }
+
+ fontStructPtr = subFontPtr->fontStructPtr;
+ encoding = subFontPtr->familyPtr->encoding;
+ isTwoByteFont = subFontPtr->familyPtr->isTwoByteFont;
+
+ widths = fontStructPtr->per_char;
+ minHi = fontStructPtr->min_byte1;
+ maxHi = fontStructPtr->max_byte1;
+ minLo = fontStructPtr->min_char_or_byte2;
+ maxLo = fontStructPtr->max_char_or_byte2;
+ scale = maxLo - minLo + 1;
+ checkLo = minLo;
+
+ if (! isTwoByteFont) {
+ if (minLo < 32) {
+ checkLo = 32;
+ }
+ }
+
+ end = (row + 1) << FONTMAP_SHIFT;
+ for (i = row << FONTMAP_SHIFT; i < end; i++) {
+ int hi, lo;
+
+ if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i, src),
+ TCL_ENCODING_STOPONERROR, NULL, buf, sizeof(buf), NULL,
+ NULL, NULL) != TCL_OK) {
+ continue;
+ }
+ if (isTwoByteFont) {
+ hi = ((unsigned char *) buf)[0];
+ lo = ((unsigned char *) buf)[1];
+ } else {
+ hi = 0;
+ lo = ((unsigned char *) buf)[0];
+ }
+ if ((hi < minHi) || (hi > maxHi) || (lo < checkLo) || (lo > maxLo)) {
+ continue;
+ }
+ n = (hi - minHi) * scale + lo - minLo;
+ if ((widths == NULL) || ((widths[n].width + widths[n].rbearing) != 0)) {
+ bitOffset = i & (FONTMAP_BITSPERPAGE - 1);
+ subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
+ }
+ }
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * CanUseFallbackWithAliases --
+ *
+ * Helper function for FindSubFontForChar. Determine if the
+ * specified face name (or an alias of the specified face name)
+ * can be used to construct a screen font that can display the
+ * given character.
+ *
+ * Results:
+ * See CanUseFallback().
+ *
+ * Side effects:
+ * If the name and/or one of its aliases was rejected, the
+ * rejected string is recorded in nameTriedPtr so that it won't
+ * be tried again.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static SubFont *
+CanUseFallbackWithAliases(fontPtr, faceName, ch, nameTriedPtr)
+ UnixFont *fontPtr; /* The font object that will own the new
+ * screen font. */
+ char *faceName; /* Desired face name for new screen font. */
+ int ch; /* The Unicode character that the new
+ * screen font must be able to display. */
+ Tcl_DString *nameTriedPtr; /* Records face names that have already
+ * been tried. It is possible for the same
+ * face name to be queried multiple times when
+ * trying to find a suitable screen font. */
+{
+ SubFont *subFontPtr;
+ char **aliases;
+ int i;
+
+ if (SeenName(faceName, nameTriedPtr) == 0) {
+ subFontPtr = CanUseFallback(fontPtr, faceName, ch);
+ if (subFontPtr != NULL) {
+ return subFontPtr;
+ }
+ }
+ aliases = TkFontGetAliasList(faceName);
+ if (aliases != NULL) {
+ for (i = 0; aliases[i] != NULL; i++) {
+ if (SeenName(aliases[i], nameTriedPtr) == 0) {
+ subFontPtr = CanUseFallback(fontPtr, aliases[i], ch);
+ if (subFontPtr != NULL) {
+ return subFontPtr;
+ }
+ }
+ }
+ }
+ return NULL;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * SeenName --
+ *
+ * Used to determine we have already tried and rejected the given
+ * face name when looking for a screen font that can support some
+ * Unicode character.
+ *
+ * Results:
+ * The return value is 0 if this face name has not already been seen,
+ * non-zero otherwise.
*
* Side effects:
* None.
@@ -980,19 +1920,659 @@ AllocFont(tkFontPtr, tkwin, fontStructPtr, fontName)
*/
static int
-GetControlCharSubst(c, buf)
- int c; /* The control character to be replaced. */
- char buf[4]; /* Buffer that gets replacement string. It
- * only needs to be 4 characters long. */
+SeenName(name, dsPtr)
+ CONST char *name; /* The name to check. */
+ Tcl_DString *dsPtr; /* Contains names that have already been
+ * seen. */
+{
+ CONST char *seen, *end;
+
+ seen = Tcl_DStringValue(dsPtr);
+ end = seen + Tcl_DStringLength(dsPtr);
+ while (seen < end) {
+ if (strcasecmp(seen, name) == 0) {
+ return 1;
+ }
+ seen += strlen(seen) + 1;
+ }
+ Tcl_DStringAppend(dsPtr, (char *) name, (int) (strlen(name) + 1));
+ return 0;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * CanUseFallback --
+ *
+ * If the specified screen font has not already been loaded
+ * into the font object, determine if the specified screen
+ * font can display the given character.
+ *
+ * Results:
+ * The return value is a pointer to a newly allocated SubFont,
+ * owned by the font object. This SubFont can be used to display
+ * the given character. The SubFont represents the screen font
+ * with the base set of font attributes from the font object, but
+ * using the specified face name. NULL is returned if the font
+ * object already holds a reference to the specified font or if
+ * the specified font doesn't exist or cannot display the given
+ * character.
+ *
+ * Side effects:
+ * The font object's subFontArray is updated to contain a reference
+ * to the newly allocated SubFont.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static SubFont *
+CanUseFallback(fontPtr, faceName, ch)
+ UnixFont *fontPtr; /* The font object that will own the new
+ * screen font. */
+ char *faceName; /* Desired face name for new screen font. */
+ int ch; /* The Unicode character that the new
+ * screen font must be able to display. */
{
- buf[0] = '\\';
- if ((c < sizeof(mapChars)) && (mapChars[c] != 0)) {
- buf[1] = mapChars[c];
- return 2;
+ int i, nameIdx, numNames, srcLen;
+ Tk_Uid hateFoundry;
+ int bestIdx[2];
+ CONST char *charset, *hateCharset;
+ unsigned int bestScore[2];
+ char **nameList, **nameListOrig;
+ FontAttributes want, got;
+ char src[TCL_UTF_MAX];
+ Display *display;
+ SubFont subFont;
+ XFontStruct *fontStructPtr;
+ Tcl_DString dsEncodings;
+ int numEncodings;
+ Tcl_Encoding *encodingCachePtr;
+
+ /*
+ * Assume: the face name is times.
+ * Assume: adobe:times:iso8859-1 has already been used.
+ *
+ * Are there any versions of times that can display this
+ * character (e.g., perhaps linotype:times:iso8859-2)?
+ * a. Get list of all times fonts.
+ * b1. Cross out all names whose encodings we've already used.
+ * b2. Cross out all names whose foundry & encoding we've already seen.
+ * c. Cross out all names whose encoding cannot handle the character.
+ * d. Rank each name and pick the best match.
+ * e. If that font cannot actually display the character, cross
+ * out all names with the same foundry and encoding and go
+ * back to (c).
+ */
+
+ display = fontPtr->display;
+ nameList = ListFonts(display, faceName, &numNames);
+ if (numNames == 0) {
+ return NULL;
+ }
+ nameListOrig = nameList;
+
+ srcLen = Tcl_UniCharToUtf(ch, src);
+
+ want.fa = fontPtr->font.fa;
+ want.xa = fontPtr->xa;
+
+ want.fa.family = Tk_GetUid(faceName);
+ want.fa.size = -fontPtr->pixelSize;
+
+ hateFoundry = NULL;
+ hateCharset = NULL;
+ numEncodings = 0;
+ Tcl_DStringInit(&dsEncodings);
+
+ charset = NULL; /* lint, since numNames must be > 0 to get here. */
+
+ retry:
+ bestIdx[0] = -1;
+ bestIdx[1] = -1;
+ bestScore[0] = (unsigned int) -1;
+ bestScore[1] = (unsigned int) -1;
+ for (nameIdx = 0; nameIdx < numNames; nameIdx++) {
+ Tcl_Encoding encoding;
+ char dst[16];
+ int scalable, srcRead, dstWrote;
+ unsigned int score;
+
+ if (nameList[nameIdx] == NULL) {
+ continue;
+ }
+ if (TkFontParseXLFD(nameList[nameIdx], &got.fa, &got.xa) != TCL_OK) {
+ goto crossout;
+ }
+ IdentifySymbolEncodings(&got);
+ charset = GetEncodingAlias(got.xa.charset);
+ if (hateFoundry != NULL) {
+ /*
+ * E. If the font we picked cannot actually display the
+ * character, cross out all names with the same foundry and
+ * encoding.
+ */
+
+ if ((hateFoundry == got.xa.foundry)
+ && (strcmp(hateCharset, charset) == 0)) {
+ goto crossout;
+ }
+ } else {
+ /*
+ * B. Cross out all names whose encodings we've already used.
+ */
+
+ for (i = 0; i < fontPtr->numSubFonts; i++) {
+ encoding = fontPtr->subFontArray[i].familyPtr->encoding;
+ if (strcmp(charset, Tcl_GetEncodingName(encoding)) == 0) {
+ goto crossout;
+ }
+ }
+ }
+
+ /*
+ * C. Cross out all names whose encoding cannot handle the character.
+ */
+
+ encodingCachePtr = (Tcl_Encoding *) Tcl_DStringValue(&dsEncodings);
+ for (i = numEncodings; --i >= 0; encodingCachePtr++) {
+ encoding = *encodingCachePtr;
+ if (strcmp(Tcl_GetEncodingName(encoding), charset) == 0) {
+ break;
+ }
+ }
+ if (i < 0) {
+ encoding = Tcl_GetEncoding(NULL, charset);
+ if (encoding == NULL) {
+ goto crossout;
+ }
+
+ Tcl_DStringAppend(&dsEncodings, (char *) &encoding,
+ sizeof(encoding));
+ numEncodings++;
+ }
+ Tcl_UtfToExternal(NULL, encoding, src, srcLen,
+ TCL_ENCODING_STOPONERROR, NULL, dst, sizeof(dst), &srcRead,
+ &dstWrote, NULL);
+ if (dstWrote == 0) {
+ goto crossout;
+ }
+
+ /*
+ * D. Rank each name and pick the best match.
+ */
+
+ scalable = (got.fa.size == 0);
+ score = RankAttributes(&want, &got);
+ if (score <= bestScore[scalable]) {
+ bestIdx[scalable] = nameIdx;
+ bestScore[scalable] = score;
+ }
+ if (score == 0) {
+ break;
+ }
+ continue;
+
+ crossout:
+ if (nameList == nameListOrig) {
+ /*
+ * Not allowed to change pointers to memory that X gives you,
+ * so make a copy.
+ */
+
+ nameList = (char **) ckalloc(numNames * sizeof(char *));
+ memcpy(nameList, nameListOrig, numNames * sizeof(char *));
+ }
+ nameList[nameIdx] = NULL;
+ }
+
+ fontStructPtr = GetScreenFont(display, &want, nameList, bestIdx, bestScore);
+
+ encodingCachePtr = (Tcl_Encoding *) Tcl_DStringValue(&dsEncodings);
+ for (i = numEncodings; --i >= 0; encodingCachePtr++) {
+ Tcl_FreeEncoding(*encodingCachePtr);
+ }
+ Tcl_DStringFree(&dsEncodings);
+ numEncodings = 0;
+
+ if (fontStructPtr == NULL) {
+ if (nameList != nameListOrig) {
+ ckfree((char *) nameList);
+ }
+ XFreeFontNames(nameListOrig);
+ return NULL;
+ }
+
+ InitSubFont(display, fontStructPtr, 0, &subFont);
+ if (FontMapLookup(&subFont, ch) == 0) {
+ /*
+ * E. If the font we picked cannot actually display the character,
+ * cross out all names with the same foundry and encoding and pick
+ * another font.
+ */
+
+ hateFoundry = got.xa.foundry;
+ hateCharset = charset;
+ ReleaseSubFont(display, &subFont);
+ goto retry;
+ }
+ if (nameList != nameListOrig) {
+ ckfree((char *) nameList);
+ }
+ XFreeFontNames(nameListOrig);
+
+ if (fontPtr->numSubFonts >= SUBFONT_SPACE) {
+ SubFont *newPtr;
+
+ newPtr = (SubFont *) ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
+ memcpy((char *) newPtr, fontPtr->subFontArray,
+ fontPtr->numSubFonts * sizeof(SubFont));
+ if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
+ ckfree((char *) fontPtr->subFontArray);
+ }
+ fontPtr->subFontArray = newPtr;
+ }
+ fontPtr->subFontArray[fontPtr->numSubFonts] = subFont;
+ fontPtr->numSubFonts++;
+ return &fontPtr->subFontArray[fontPtr->numSubFonts - 1];
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * RankAttributes --
+ *
+ * Determine how close the attributes of the font in question match
+ * the attributes that we want.
+ *
+ * Results:
+ * The return value is the score; lower numbers are better.
+ * *scalablePtr is set to 0 if the font was not scalable, 1 otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static unsigned int
+RankAttributes(wantPtr, gotPtr)
+ FontAttributes *wantPtr; /* The desired attributes. */
+ FontAttributes *gotPtr; /* The attributes we have to live with. */
+{
+ unsigned int penalty;
+
+ penalty = 0;
+ if (gotPtr->xa.foundry != wantPtr->xa.foundry) {
+ penalty += 4500;
+ }
+ if (gotPtr->fa.family != wantPtr->fa.family) {
+ penalty += 9000;
+ }
+ if (gotPtr->fa.weight != wantPtr->fa.weight) {
+ penalty += 90;
+ }
+ if (gotPtr->fa.slant != wantPtr->fa.slant) {
+ penalty += 60;
+ }
+ if (gotPtr->xa.slant != wantPtr->xa.slant) {
+ penalty += 10;
+ }
+ if (gotPtr->xa.setwidth != wantPtr->xa.setwidth) {
+ penalty += 1000;
+ }
+
+ if (gotPtr->fa.size == 0) {
+ /*
+ * A scalable font is almost always acceptable, but the
+ * corresponding bitmapped font would be better.
+ */
+
+ penalty += 10;
} else {
- buf[1] = 'x';
- buf[2] = hexChars[(c >> 4) & 0xf];
- buf[3] = hexChars[c & 0xf];
- return 4;
+ int diff;
+
+ /*
+ * It's worse to be too large than to be too small.
+ */
+
+ diff = (-gotPtr->fa.size - -wantPtr->fa.size);
+ if (diff > 0) {
+ penalty += 600;
+ } else if (diff < 0) {
+ penalty += 150;
+ diff = -diff;
+ }
+ penalty += 150 * diff;
}
+ if (gotPtr->xa.charset != wantPtr->xa.charset) {
+ int i;
+ CONST char *gotAlias, *wantAlias;
+
+ penalty += 65000;
+ gotAlias = GetEncodingAlias(gotPtr->xa.charset);
+ wantAlias = GetEncodingAlias(wantPtr->xa.charset);
+ if (strcmp(gotAlias, wantAlias) != 0) {
+ penalty += 30000;
+ for (i = 0; encodingList[i] != NULL; i++) {
+ if (strcmp(gotAlias, encodingList[i]) == 0) {
+ penalty -= 30000;
+ break;
+ }
+ penalty += 20000;
+ }
+ }
+ }
+ return penalty;
}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * GetScreenFont --
+ *
+ * Given the names for the best scalable and best bitmapped font,
+ * actually construct an XFontStruct based on the best XLFD.
+ * This is where all the alias and fallback substitution bottoms
+ * out.
+ *
+ * Results:
+ * The screen font that best corresponds to the set of attributes.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static XFontStruct *
+GetScreenFont(display, wantPtr, nameList, bestIdx, bestScore)
+ Display *display; /* Display for new XFontStruct. */
+ FontAttributes *wantPtr; /* Contains desired actual pixel-size if the
+ * best font was scalable. */
+ char **nameList; /* Array of XLFDs. */
+ int bestIdx[2]; /* Indices into above array for XLFD of
+ * best bitmapped and best scalable font. */
+ unsigned int bestScore[2]; /* Scores of best bitmapped and best
+ * scalable font. XLFD corresponding to
+ * lowest score will be constructed. */
+{
+ XFontStruct *fontStructPtr;
+
+ if ((bestIdx[0] < 0) && (bestIdx[1] < 0)) {
+ return NULL;
+ }
+
+ /*
+ * Now we know which is the closest matching scalable font and the
+ * closest matching bitmapped font. If the scalable font was a
+ * better match, try getting the scalable font; however, if the
+ * scalable font was not actually available in the desired
+ * pointsize, fall back to the closest bitmapped font.
+ */
+
+ fontStructPtr = NULL;
+ if (bestScore[1] < bestScore[0]) {
+ char *str, *rest;
+ char buf[256];
+ int i;
+
+ /*
+ * Fill in the desired pixel size for this font.
+ */
+
+ tryscale:
+ str = nameList[bestIdx[1]];
+ for (i = 0; i < XLFD_PIXEL_SIZE; i++) {
+ str = strchr(str + 1, '-');
+ }
+ rest = str;
+ for (i = XLFD_PIXEL_SIZE; i < XLFD_CHARSET; i++) {
+ rest = strchr(rest + 1, '-');
+ }
+ *str = '\0';
+ sprintf(buf, "%.200s-%d-*-*-*-*-*%s", nameList[bestIdx[1]],
+ -wantPtr->fa.size, rest);
+ *str = '-';
+ fontStructPtr = XLoadQueryFont(display, buf);
+ bestScore[1] = INT_MAX;
+ }
+ if (fontStructPtr == NULL) {
+ fontStructPtr = XLoadQueryFont(display, nameList[bestIdx[0]]);
+ if (fontStructPtr == NULL) {
+ /*
+ * This shouldn't happen because the font name is one of the
+ * names that X gave us to use, but it does anyhow.
+ */
+
+ if (bestScore[1] < INT_MAX) {
+ goto tryscale;
+ }
+ return GetSystemFont(display);
+ }
+ }
+ return fontStructPtr;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * GetSystemFont --
+ *
+ * Absolute fallback mechanism, called when we need a font and no
+ * other font can be found and/or instantiated.
+ *
+ * Results:
+ * A pointer to a font. Never NULL.
+ *
+ * Side effects:
+ * If there are NO fonts installed on the system, this call will
+ * panic, but how did you get X running in that case?
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static XFontStruct *
+GetSystemFont(display)
+ Display *display; /* Display for new XFontStruct. */
+{
+ XFontStruct *fontStructPtr;
+
+ fontStructPtr = XLoadQueryFont(display, "fixed");
+ if (fontStructPtr == NULL) {
+ fontStructPtr = XLoadQueryFont(display, "*");
+ if (fontStructPtr == NULL) {
+ panic("TkpGetFontFromAttributes: cannot get any font");
+ }
+ }
+ return fontStructPtr;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * GetFontAttributes --
+ *
+ * Given a screen font, determine its actual attributes, which are
+ * not necessarily the attributes that were used to construct it.
+ *
+ * Results:
+ * *faPtr is filled with the screen font's attributes.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static int
+GetFontAttributes(display, fontStructPtr, faPtr)
+ Display *display; /* Display that owns the screen font. */
+ XFontStruct *fontStructPtr; /* Screen font to query. */
+ FontAttributes *faPtr; /* For storing attributes of screen font. */
+{
+ unsigned long value;
+ char *name;
+
+ if ((XGetFontProperty(fontStructPtr, XA_FONT, &value) != False) &&
+ (value != 0)) {
+ name = XGetAtomName(display, (Atom) value);
+ if (TkFontParseXLFD(name, &faPtr->fa, &faPtr->xa) != TCL_OK) {
+ faPtr->fa.family = Tk_GetUid(name);
+ faPtr->xa.foundry = Tk_GetUid("");
+ faPtr->xa.charset = Tk_GetUid("");
+ }
+ XFree(name);
+ } else {
+ TkInitFontAttributes(&faPtr->fa);
+ TkInitXLFDAttributes(&faPtr->xa);
+ faPtr->fa.family = Tk_GetUid("");
+ faPtr->xa.foundry = Tk_GetUid("");
+ faPtr->xa.charset = Tk_GetUid("");
+ }
+ return IdentifySymbolEncodings(faPtr);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * ListFonts --
+ *
+ * Utility function to return the array of all XLFDs on the system
+ * with the specified face name.
+ *
+ * Results:
+ * The return value is an array of XLFDs, which should be freed with
+ * XFreeFontNames(), or NULL if no XLFDs matched the requested name.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static char **
+ListFonts(display, faceName, numNamesPtr)
+ Display *display; /* Display to query. */
+ CONST char *faceName; /* Desired face name, or "*" for all. */
+ int *numNamesPtr; /* Filled with length of returned array, or
+ * 0 if no names were found. */
+{
+ char buf[256];
+
+ sprintf(buf, "-*-%.80s-*-*-*-*-*-*-*-*-*-*-*-*", faceName);
+ return XListFonts(display, buf, 10000, numNamesPtr);
+}
+
+static char **
+ListFontOrAlias(display, faceName, numNamesPtr)
+ Display *display; /* Display to query. */
+ CONST char *faceName; /* Desired face name, or "*" for all. */
+ int *numNamesPtr; /* Filled with length of returned array, or
+ * 0 if no names were found. */
+{
+ char **nameList, **aliases;
+ int i;
+
+ nameList = ListFonts(display, faceName, numNamesPtr);
+ if (nameList != NULL) {
+ return nameList;
+ }
+ aliases = TkFontGetAliasList(faceName);
+ if (aliases != NULL) {
+ for (i = 0; aliases[i] != NULL; i++) {
+ nameList = ListFonts(display, aliases[i], numNamesPtr);
+ if (nameList != NULL) {
+ return nameList;
+ }
+ }
+ }
+ *numNamesPtr = 0;
+ return NULL;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * IdentifySymbolEncodings --
+ *
+ * If the font attributes refer to a symbol font, update the
+ * charset field of the font attributes so that it reflects the
+ * encoding of that symbol font. In general, the raw value for
+ * the charset field parsed from an XLFD is meaningless for symbol
+ * fonts.
+ *
+ * Symbol fonts are all fonts whose name appears in the symbolClass.
+ *
+ * Results:
+ * The return value is non-zero if the font attributes specify a
+ * symbol font, or 0 otherwise. If a non-zero value is returned
+ * the charset field of the font attributes will be changed to
+ * the string that represents the actual encoding for the symbol font.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static int
+IdentifySymbolEncodings(faPtr)
+ FontAttributes *faPtr;
+{
+ int i, j;
+ char **aliases, **symbolClass;
+
+ symbolClass = TkFontGetSymbolClass();
+ for (i = 0; symbolClass[i] != NULL; i++) {
+ if (strcasecmp(faPtr->fa.family, symbolClass[i]) == 0) {
+ faPtr->xa.charset = Tk_GetUid(GetEncodingAlias(symbolClass[i]));
+ return 1;
+ }
+ aliases = TkFontGetAliasList(symbolClass[i]);
+ for (j = 0; (aliases != NULL) && (aliases[j] != NULL); j++) {
+ if (strcasecmp(faPtr->fa.family, aliases[j]) == 0) {
+ faPtr->xa.charset = Tk_GetUid(GetEncodingAlias(aliases[j]));
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * GetEncodingAlias --
+ *
+ * Map the name of an encoding to another name that should be used
+ * when actually loading the encoding. For instance, the encodings
+ * "jisc6226.1978", "jisx0208.1983", "jisx0208.1990", and
+ * "jisx0208.1996" are well-known names for the same encoding and
+ * are represented by one encoding table: "jis0208".
+ *
+ * Results:
+ * As above. If the name has no alias, the original name is returned.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static CONST char *
+GetEncodingAlias(name)
+ CONST char *name; /* The name to look up. */
+{
+ EncodingAlias *aliasPtr;
+
+ for (aliasPtr = encodingAliases; aliasPtr->aliasPattern != NULL; ) {
+ if (Tcl_StringMatch((char *) name, aliasPtr->aliasPattern)) {
+ return aliasPtr->realName;
+ }
+ aliasPtr++;
+ }
+ return name;
+}
+
+
+
diff --git a/tk/unix/tkUnixInit.c b/tk/unix/tkUnixInit.c
index a566f0fba1b..7f3a4b0fe5a 100644
--- a/tk/unix/tkUnixInit.c
+++ b/tk/unix/tkUnixInit.c
@@ -32,7 +32,7 @@
*
* Results:
* Returns a standard Tcl result. Leaves an error message or result
- * in interp->result.
+ * in the interp's result.
*
* Side effects:
* Sets "tk_library" Tcl variable, runs "tk.tcl" script.
@@ -109,9 +109,10 @@ TkpDisplayWarning(msg, title)
{
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
- Tcl_Write(errChannel, title, -1);
- Tcl_Write(errChannel, ": ", 2);
- Tcl_Write(errChannel, msg, -1);
- Tcl_Write(errChannel, "\n", 1);
+ Tcl_WriteChars(errChannel, title, -1);
+ Tcl_WriteChars(errChannel, ": ", 2);
+ Tcl_WriteChars(errChannel, msg, -1);
+ Tcl_WriteChars(errChannel, "\n", 1);
}
}
+
diff --git a/tk/unix/tkUnixInt.h b/tk/unix/tkUnixInt.h
index 00b9d14a978..73becfb17f3 100644
--- a/tk/unix/tkUnixInt.h
+++ b/tk/unix/tkUnixInt.h
@@ -16,17 +16,15 @@
#ifndef _TKUNIXINT
#define _TKUNIXINT
+#ifndef _TKINT
+#include "tkInt.h"
+#endif
+
/*
* Prototypes for procedures that are referenced in files other
* than the ones they're defined in.
*/
-
-EXTERN void TkCreateXEventSource _ANSI_ARGS_((void));
-EXTERN TkWindow * TkpGetContainer _ANSI_ARGS_((TkWindow *embeddedPtr));
-EXTERN TkWindow * TkpGetWrapperWindow _ANSI_ARGS_((TkWindow *winPtr));
-EXTERN Window TkUnixContainerId _ANSI_ARGS_((TkWindow *winPtr));
-EXTERN int TkUnixDoOneXEvent _ANSI_ARGS_((Tcl_Time *timePtr));
-EXTERN void TkUnixSetMenubar _ANSI_ARGS_((Tk_Window tkwin,
- Tk_Window menubar));
+#include "tkIntPlatDecls.h"
#endif /* _TKUNIXINT */
+
diff --git a/tk/unix/tkUnixKey.c b/tk/unix/tkUnixKey.c
new file mode 100644
index 00000000000..9c3f7f1d6f0
--- /dev/null
+++ b/tk/unix/tkUnixKey.c
@@ -0,0 +1,355 @@
+/*
+ * tkUnixKey.c --
+ *
+ * This file contains routines for dealing with international keyboard
+ * input.
+ *
+ * Copyright (c) 1997 by Sun Microsystems, Inc.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * RCS: @(#) $Id$
+ */
+
+#include "tkInt.h"
+
+/*
+ * Prototypes for local procedures defined in this file:
+ */
+
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetString --
+ *
+ * Retrieve the UTF string associated with a keyboard event.
+ *
+ * Results:
+ * Returns the UTF string.
+ *
+ * Side effects:
+ * Stores the input string in the specified Tcl_DString. Modifies
+ * the internal input state. This routine can only be called
+ * once for a given event.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char *
+TkpGetString(winPtr, eventPtr, dsPtr)
+ TkWindow *winPtr; /* Window where event occurred: needed to
+ * get input context. */
+ XEvent *eventPtr; /* X keyboard event. */
+ Tcl_DString *dsPtr; /* Uninitialized or empty string to hold
+ * result. */
+{
+ int len;
+ Tcl_DString buf;
+ Status status;
+
+ /*
+ * Overallocate the dstring to the maximum stack amount.
+ */
+
+ Tcl_DStringInit(&buf);
+ Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
+
+#ifdef TK_USE_INPUT_METHODS
+ if (winPtr->dispPtr->useInputMethods
+ && (winPtr->inputContext != NULL)
+ && (eventPtr->type == KeyPress)) {
+ len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
+ Tcl_DStringValue(&buf), Tcl_DStringLength(&buf),
+ (KeySym *) NULL, &status);
+ /*
+ * If the buffer wasn't big enough, grow the buffer and try again.
+ */
+
+ if (status == XBufferOverflow) {
+ Tcl_DStringSetLength(&buf, len);
+ len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
+ Tcl_DStringValue(&buf), len, (KeySym *) NULL, &status);
+ }
+ if ((status != XLookupChars) && (status != XLookupBoth)) {
+ len = 0;
+ }
+ } else {
+ len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf),
+ Tcl_DStringLength(&buf), (KeySym *) NULL,
+ (XComposeStatus *) NULL);
+ }
+#else /* TK_USE_INPUT_METHODS */
+ len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf),
+ Tcl_DStringLength(&buf), (KeySym *) NULL,
+ (XComposeStatus *) NULL);
+#endif /* TK_USE_INPUT_METHODS */
+ Tcl_DStringSetLength(&buf, len);
+
+ Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&buf), len, dsPtr);
+ Tcl_DStringFree(&buf);
+
+ return Tcl_DStringValue(dsPtr);
+}
+
+/*
+ * When mapping from a keysym to a keycode, need
+ * information about the modifier state that should be used
+ * so that when they call XKeycodeToKeysym taking into
+ * account the xkey.state, they will get back the original
+ * keysym.
+ */
+
+void
+TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
+ Tk_Window tkwin;
+ KeySym keySym;
+ XEvent *eventPtr;
+{
+ Display *display;
+ int state;
+ KeyCode keycode;
+
+ display = Tk_Display(tkwin);
+
+ if (keySym == NoSymbol) {
+ keycode = 0;
+ } else {
+ keycode = XKeysymToKeycode(display, keySym);
+ }
+ if (keycode != 0) {
+ for (state = 0; state < 4; state++) {
+ if (XKeycodeToKeysym(display, keycode, state) == keySym) {
+ if (state & 1) {
+ eventPtr->xkey.state |= ShiftMask;
+ }
+ if (state & 2) {
+ TkDisplay *dispPtr;
+
+ dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ eventPtr->xkey.state |= dispPtr->modeModMask;
+ }
+ break;
+ }
+ }
+ }
+ eventPtr->xkey.keycode = keycode;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetKeySym --
+ *
+ * Given an X KeyPress or KeyRelease event, map the
+ * keycode in the event into a KeySym.
+ *
+ * Results:
+ * The return value is the KeySym corresponding to
+ * eventPtr, or NoSymbol if no matching Keysym could be
+ * found.
+ *
+ * Side effects:
+ * In the first call for a given display, keycode-to-
+ * KeySym maps get loaded.
+ *
+ *----------------------------------------------------------------------
+ */
+
+KeySym
+TkpGetKeySym(dispPtr, eventPtr)
+ TkDisplay *dispPtr; /* Display in which to
+ * map keycode. */
+ XEvent *eventPtr; /* Description of X event. */
+{
+ KeySym sym;
+ int index;
+
+ /*
+ * Refresh the mapping information if it's stale
+ */
+
+ if (dispPtr->bindInfoStale) {
+ TkpInitKeymapInfo(dispPtr);
+ }
+
+ /*
+ * Figure out which of the four slots in the keymap vector to
+ * use for this key. Refer to Xlib documentation for more info
+ * on how this computation works.
+ */
+
+ index = 0;
+ if (eventPtr->xkey.state & dispPtr->modeModMask) {
+ index = 2;
+ }
+ if ((eventPtr->xkey.state & ShiftMask)
+ || ((dispPtr->lockUsage != LU_IGNORE)
+ && (eventPtr->xkey.state & LockMask))) {
+ index += 1;
+ }
+ sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, index);
+
+ /*
+ * Special handling: if the key was shifted because of Lock, but
+ * lock is only caps lock, not shift lock, and the shifted keysym
+ * isn't upper-case alphabetic, then switch back to the unshifted
+ * keysym.
+ */
+
+ if ((index & 1) && !(eventPtr->xkey.state & ShiftMask)
+ && (dispPtr->lockUsage == LU_CAPS)) {
+ if (!(((sym >= XK_A) && (sym <= XK_Z))
+ || ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
+ || ((sym >= XK_Ooblique) && (sym <= XK_Thorn)))) {
+ index &= ~1;
+ sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
+ index);
+ }
+ }
+
+ /*
+ * Another bit of special handling: if this is a shifted key and there
+ * is no keysym defined, then use the keysym for the unshifted key.
+ */
+
+ if ((index & 1) && (sym == NoSymbol)) {
+ sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
+ index & ~1);
+ }
+ return sym;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkpInitKeymapInfo --
+ *
+ * This procedure is invoked to scan keymap information
+ * to recompute stuff that's important for binding, such
+ * as the modifier key (if any) that corresponds to "mode
+ * switch".
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Keymap-related information in dispPtr is updated.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+TkpInitKeymapInfo(dispPtr)
+ TkDisplay *dispPtr; /* Display for which to recompute keymap
+ * information. */
+{
+ XModifierKeymap *modMapPtr;
+ KeyCode *codePtr;
+ KeySym keysym;
+ int count, i, j, max, arraySize;
+#define KEYCODE_ARRAY_SIZE 20
+
+ dispPtr->bindInfoStale = 0;
+ modMapPtr = XGetModifierMapping(dispPtr->display);
+
+ /*
+ * Check the keycodes associated with the Lock modifier. If
+ * any of them is associated with the XK_Shift_Lock modifier,
+ * then Lock has to be interpreted as Shift Lock, not Caps Lock.
+ */
+
+ dispPtr->lockUsage = LU_IGNORE;
+ codePtr = modMapPtr->modifiermap + modMapPtr->max_keypermod*LockMapIndex;
+ for (count = modMapPtr->max_keypermod; count > 0; count--, codePtr++) {
+ if (*codePtr == 0) {
+ continue;
+ }
+ keysym = XKeycodeToKeysym(dispPtr->display, *codePtr, 0);
+ if (keysym == XK_Shift_Lock) {
+ dispPtr->lockUsage = LU_SHIFT;
+ break;
+ }
+ if (keysym == XK_Caps_Lock) {
+ dispPtr->lockUsage = LU_CAPS;
+ break;
+ }
+ }
+
+ /*
+ * Look through the keycodes associated with modifiers to see if
+ * the the "mode switch", "meta", or "alt" keysyms are associated
+ * with any modifiers. If so, remember their modifier mask bits.
+ */
+
+ dispPtr->modeModMask = 0;
+ dispPtr->metaModMask = 0;
+ dispPtr->altModMask = 0;
+ codePtr = modMapPtr->modifiermap;
+ max = 8*modMapPtr->max_keypermod;
+ for (i = 0; i < max; i++, codePtr++) {
+ if (*codePtr == 0) {
+ continue;
+ }
+ keysym = XKeycodeToKeysym(dispPtr->display, *codePtr, 0);
+ if (keysym == XK_Mode_switch) {
+ dispPtr->modeModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
+ }
+ if ((keysym == XK_Meta_L) || (keysym == XK_Meta_R)) {
+ dispPtr->metaModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
+ }
+ if ((keysym == XK_Alt_L) || (keysym == XK_Alt_R)) {
+ dispPtr->altModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
+ }
+ }
+
+ /*
+ * Create an array of the keycodes for all modifier keys.
+ */
+
+ if (dispPtr->modKeyCodes != NULL) {
+ ckfree((char *) dispPtr->modKeyCodes);
+ }
+ dispPtr->numModKeyCodes = 0;
+ arraySize = KEYCODE_ARRAY_SIZE;
+ dispPtr->modKeyCodes = (KeyCode *) ckalloc((unsigned)
+ (KEYCODE_ARRAY_SIZE * sizeof(KeyCode)));
+ for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) {
+ if (*codePtr == 0) {
+ continue;
+ }
+
+ /*
+ * Make sure that the keycode isn't already in the array.
+ */
+
+ for (j = 0; j < dispPtr->numModKeyCodes; j++) {
+ if (dispPtr->modKeyCodes[j] == *codePtr) {
+ goto nextModCode;
+ }
+ }
+ if (dispPtr->numModKeyCodes >= arraySize) {
+ KeyCode *new;
+
+ /*
+ * Ran out of space in the array; grow it.
+ */
+
+ arraySize *= 2;
+ new = (KeyCode *) ckalloc((unsigned)
+ (arraySize * sizeof(KeyCode)));
+ memcpy((VOID *) new, (VOID *) dispPtr->modKeyCodes,
+ (dispPtr->numModKeyCodes * sizeof(KeyCode)));
+ ckfree((char *) dispPtr->modKeyCodes);
+ dispPtr->modKeyCodes = new;
+ }
+ dispPtr->modKeyCodes[dispPtr->numModKeyCodes] = *codePtr;
+ dispPtr->numModKeyCodes++;
+ nextModCode: continue;
+ }
+ XFreeModifiermap(modMapPtr);
+}
+
+
diff --git a/tk/unix/tkUnixMenu.c b/tk/unix/tkUnixMenu.c
index 1b53d8b61a9..1ee5df86494 100644
--- a/tk/unix/tkUnixMenu.c
+++ b/tk/unix/tkUnixMenu.c
@@ -3,7 +3,7 @@
*
* This module implements the UNIX platform-specific features of menus.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -178,7 +178,7 @@ TkpDestroyMenuEntry(mEntryPtr)
*
* Results:
* Returns standard TCL result. If TCL_ERROR is returned, then
- * interp->result contains an error message.
+ * the interp's result contains an error message.
*
* Side effects:
* Configuration information get set for mePtr; old resources
@@ -198,11 +198,11 @@ TkpConfigureMenuEntry(mePtr)
* see if the child menu is a help menu.
*/
- if ((mePtr->type == CASCADE_ENTRY) && (mePtr->name != NULL)) {
+ if ((mePtr->type == CASCADE_ENTRY) && (mePtr->namePtr != NULL)) {
TkMenuReferences *menuRefPtr;
- menuRefPtr = TkFindMenuReferences(mePtr->menuPtr->interp,
- mePtr->name);
+ menuRefPtr = TkFindMenuReferencesObj(mePtr->menuPtr->interp,
+ mePtr->namePtr);
if ((menuRefPtr != NULL) && (menuRefPtr->menuPtr != NULL)) {
SetHelpMenu(menuRefPtr->menuPtr);
}
@@ -321,32 +321,46 @@ GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
int *widthPtr; /* The resulting width */
int *heightPtr; /* The resulting height */
{
- if (!mePtr->hideMargin && mePtr->indicatorOn &&
- ((mePtr->type == CHECK_BUTTON_ENTRY)
- || (mePtr->type == RADIO_BUTTON_ENTRY))) {
- if ((mePtr->image != NULL) || (mePtr->bitmap != None)) {
- *widthPtr = (14 * mePtr->height) / 10;
- *heightPtr = mePtr->height;
- if (mePtr->type == CHECK_BUTTON_ENTRY) {
- mePtr->platformEntryData =
- (TkMenuPlatformEntryData) ((65 * mePtr->height) / 100);
+ if ((mePtr->type == CHECK_BUTTON_ENTRY)
+ || (mePtr->type == RADIO_BUTTON_ENTRY)) {
+ if (!mePtr->hideMargin && mePtr->indicatorOn) {
+ if ((mePtr->image != NULL) || (mePtr->bitmapPtr != NULL)) {
+ *widthPtr = (14 * mePtr->height) / 10;
+ *heightPtr = mePtr->height;
+ if (mePtr->type == CHECK_BUTTON_ENTRY) {
+ mePtr->platformEntryData =
+ (TkMenuPlatformEntryData) ((65 * mePtr->height)
+ / 100);
+ } else {
+ mePtr->platformEntryData =
+ (TkMenuPlatformEntryData) ((75 * mePtr->height)
+ / 100);
+ }
} else {
- mePtr->platformEntryData =
- (TkMenuPlatformEntryData) ((75 * mePtr->height) / 100);
- }
- } else {
- *widthPtr = *heightPtr = mePtr->height;
- if (mePtr->type == CHECK_BUTTON_ENTRY) {
- mePtr->platformEntryData = (TkMenuPlatformEntryData)
+ *widthPtr = *heightPtr = mePtr->height;
+ if (mePtr->type == CHECK_BUTTON_ENTRY) {
+ mePtr->platformEntryData = (TkMenuPlatformEntryData)
((80 * mePtr->height) / 100);
- } else {
- mePtr->platformEntryData = (TkMenuPlatformEntryData)
+ } else {
+ mePtr->platformEntryData = (TkMenuPlatformEntryData)
mePtr->height;
+ }
}
+ } else {
+ int borderWidth;
+
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
+ menuPtr->borderWidthPtr, &borderWidth);
+ *heightPtr = 0;
+ *widthPtr = borderWidth;
}
} else {
+ int borderWidth;
+
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ &borderWidth);
*heightPtr = 0;
- *widthPtr = menuPtr->borderWidth;
+ *widthPtr = borderWidth;
}
}
@@ -379,8 +393,11 @@ GetMenuAccelGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*heightPtr = fmPtr->linespace;
if (mePtr->type == CASCADE_ENTRY) {
*widthPtr = 2 * CASCADE_ARROW_WIDTH;
- } else if ((menuPtr->menuType != MENUBAR) && (mePtr->accel != NULL)) {
- *widthPtr = Tk_TextWidth(tkfont, mePtr->accel, mePtr->accelLength);
+ } else if ((menuPtr->menuType != MENUBAR)
+ && (mePtr->accelPtr != NULL)) {
+ char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
+
+ *widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
} else {
*widthPtr = 0;
}
@@ -416,8 +433,10 @@ DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder, bgBorder, x, y,
int width; /* Width of entry rect */
int height; /* Height of entry rect */
{
- if (mePtr->state == tkActiveUid) {
+ if (mePtr->state == ENTRY_ACTIVE) {
int relief;
+ int activeBorderWidth;
+
bgBorder = activeBorder;
if ((menuPtr->menuType == MENUBAR)
@@ -427,9 +446,11 @@ DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder, bgBorder, x, y,
} else {
relief = TK_RELIEF_RAISED;
}
-
+
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
+ menuPtr->activeBorderWidthPtr, &activeBorderWidth);
Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height,
- menuPtr->activeBorderWidth, relief);
+ activeBorderWidth, relief);
} else {
Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height,
0, TK_RELIEF_FLAT);
@@ -470,6 +491,7 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
int drawArrow; /* Whether or not to draw arrow. */
{
XPoint points[3];
+ int borderWidth, activeBorderWidth;
/*
* Draw accelerator or cascade arrow.
@@ -479,9 +501,13 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
return;
}
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ &borderWidth);
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
+ &activeBorderWidth);
if ((mePtr->type == CASCADE_ENTRY) && drawArrow) {
- points[0].x = x + width - menuPtr->borderWidth
- - menuPtr->activeBorderWidth - CASCADE_ARROW_WIDTH;
+ points[0].x = x + width - borderWidth - activeBorderWidth
+ - CASCADE_ARROW_WIDTH;
points[0].y = y + (height - CASCADE_ARROW_HEIGHT)/2;
points[1].x = points[0].x;
points[1].y = points[0].y + CASCADE_ARROW_HEIGHT;
@@ -491,13 +517,15 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr, activeBorder,
DECORATION_BORDER_WIDTH,
(menuPtr->postedCascade == mePtr)
? TK_RELIEF_SUNKEN : TK_RELIEF_RAISED);
- } else if (mePtr->accel != NULL) {
- int left = x + mePtr->labelWidth + menuPtr->activeBorderWidth
+ } else if (mePtr->accelPtr != NULL) {
+ char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
+ int left = x + mePtr->labelWidth + activeBorderWidth
+ mePtr->indicatorSpace;
+
if (menuPtr->menuType == MENUBAR) {
left += 5;
}
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, mePtr->accel,
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
mePtr->accelLength, left,
(y + (height + fmPtr->ascent - fmPtr->descent) / 2));
}
@@ -535,62 +563,67 @@ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr,
int width; /* Width of menu entry */
int height; /* Height of menu entry */
{
-
/*
* Draw check-button indicator.
*/
- if ((mePtr->type == CHECK_BUTTON_ENTRY)
- && mePtr->indicatorOn) {
- int dim, top, left;
+ if ((mePtr->type == CHECK_BUTTON_ENTRY) && mePtr->indicatorOn) {
+ int dim, top, left;
+ int activeBorderWidth;
+ Tk_3DBorder border;
dim = (int) mePtr->platformEntryData;
- left = x + menuPtr->activeBorderWidth
- + (mePtr->indicatorSpace - dim)/2;
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
+ menuPtr->activeBorderWidthPtr, &activeBorderWidth);
+ left = x + activeBorderWidth + (mePtr->indicatorSpace - dim)/2;
if (menuPtr->menuType == MENUBAR) {
left += 5;
}
- top = y + (height - dim)/2;
- Tk_Fill3DRectangle(menuPtr->tkwin, d, menuPtr->border, left, top, dim,
+ top = y + (height - dim)/2;
+ border = Tk_Get3DBorderFromObj(menuPtr->tkwin,
+ menuPtr->borderPtr);
+ Tk_Fill3DRectangle(menuPtr->tkwin, d, border, left, top, dim,
dim, DECORATION_BORDER_WIDTH, TK_RELIEF_SUNKEN);
- left += DECORATION_BORDER_WIDTH;
- top += DECORATION_BORDER_WIDTH;
- dim -= 2*DECORATION_BORDER_WIDTH;
- if ((dim > 0) && (mePtr->entryFlags
- & ENTRY_SELECTED)) {
+ left += DECORATION_BORDER_WIDTH;
+ top += DECORATION_BORDER_WIDTH;
+ dim -= 2*DECORATION_BORDER_WIDTH;
+ if ((dim > 0) && (mePtr->entryFlags
+ & ENTRY_SELECTED)) {
XFillRectangle(menuPtr->display, d, indicatorGC, left, top,
(unsigned int) dim, (unsigned int) dim);
- }
+ }
}
/*
* Draw radio-button indicator.
*/
- if ((mePtr->type == RADIO_BUTTON_ENTRY)
- && mePtr->indicatorOn) {
- XPoint points[4];
- int radius;
+ if ((mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn) {
+ XPoint points[4];
+ int radius;
+ Tk_3DBorder border;
+ border = Tk_Get3DBorderFromObj(menuPtr->tkwin,
+ menuPtr->borderPtr);
radius = ((int) mePtr->platformEntryData)/2;
- points[0].x = x + (mePtr->indicatorSpace
+ points[0].x = x + (mePtr->indicatorSpace
- (int) mePtr->platformEntryData)/2;
points[0].y = y + (height)/2;
- points[1].x = points[0].x + radius;
- points[1].y = points[0].y + radius;
- points[2].x = points[1].x + radius;
- points[2].y = points[0].y;
- points[3].x = points[1].x;
- points[3].y = points[0].y - radius;
- if (mePtr->entryFlags & ENTRY_SELECTED) {
- XFillPolygon(menuPtr->display, d, indicatorGC, points, 4, Convex,
- CoordModeOrigin);
- } else {
- Tk_Fill3DPolygon(menuPtr->tkwin, d, menuPtr->border, points, 4,
+ points[1].x = points[0].x + radius;
+ points[1].y = points[0].y + radius;
+ points[2].x = points[1].x + radius;
+ points[2].y = points[0].y;
+ points[3].x = points[1].x;
+ points[3].y = points[0].y - radius;
+ if (mePtr->entryFlags & ENTRY_SELECTED) {
+ XFillPolygon(menuPtr->display, d, indicatorGC, points, 4,
+ Convex, CoordModeOrigin);
+ } else {
+ Tk_Fill3DPolygon(menuPtr->tkwin, d, border, points, 4,
DECORATION_BORDER_WIDTH, TK_RELIEF_FLAT);
- }
- Tk_Draw3DPolygon(menuPtr->tkwin, d, menuPtr->border, points, 4,
- DECORATION_BORDER_WIDTH, TK_RELIEF_SUNKEN);
+ }
+ Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 4,
+ DECORATION_BORDER_WIDTH, TK_RELIEF_SUNKEN);
}
}
@@ -625,18 +658,18 @@ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
int height;
{
XPoint points[2];
- int margin;
+ Tk_3DBorder border;
if (menuPtr->menuType == MENUBAR) {
return;
}
- margin = (fmPtr->ascent + fmPtr->descent)/2;
points[0].x = x;
points[0].y = y + height/2;
points[1].x = width - 1;
points[1].y = points[0].y;
- Tk_Draw3DPolygon(menuPtr->tkwin, d, menuPtr->border, points, 2, 1,
+ border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr);
+ Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 2, 1,
TK_RELIEF_RAISED);
}
@@ -658,30 +691,27 @@ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
*/
static void
-DrawMenuEntryLabel(
- menuPtr, /* The menu we are drawing */
- mePtr, /* The entry we are drawing */
- d, /* What we are drawing into */
- gc, /* The gc we are drawing into */
- tkfont, /* The precalculated font */
- fmPtr, /* The precalculated font metrics */
- x, /* left edge */
- y, /* right edge */
- width, /* width of entry */
- height) /* height of entry */
- TkMenu *menuPtr;
- TkMenuEntry *mePtr;
- Drawable d;
- GC gc;
- Tk_Font tkfont;
- CONST Tk_FontMetrics *fmPtr;
- int x, y, width, height;
+DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
+ TkMenu *menuPtr; /* The menu we are drawing. */
+ TkMenuEntry *mePtr; /* The entry we are drawing. */
+ Drawable d; /* What we are drawing into. */
+ GC gc; /* The gc we are drawing into.*/
+ Tk_Font tkfont; /* The precalculated font. */
+ CONST Tk_FontMetrics *fmPtr;/* The precalculated font metrics. */
+ int x; /* Left edge. */
+ int y; /* Top edge. */
+ int width; /* width of entry. */
+ int height; /* height of entry. */
{
int baseline;
int indicatorSpace = mePtr->indicatorSpace;
- int leftEdge = x + indicatorSpace + menuPtr->activeBorderWidth;
+ int activeBorderWidth;
+ int leftEdge;
int imageHeight, imageWidth;
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
+ &activeBorderWidth);
+ leftEdge = x + indicatorSpace + activeBorderWidth;
if (menuPtr->menuType == MENUBAR) {
leftEdge += 5;
}
@@ -703,27 +733,25 @@ DrawMenuEntryLabel(
imageHeight, d, leftEdge,
(int) (y + (mePtr->height - imageHeight)/2));
}
- } else if (mePtr->bitmap != None) {
+ } else if (mePtr->bitmapPtr != None) {
int width, height;
-
- Tk_SizeOfBitmap(menuPtr->display,
- mePtr->bitmap, &width, &height);
- XCopyPlane(menuPtr->display,
- mePtr->bitmap, d,
- gc, 0, 0, (unsigned) width, (unsigned) height, leftEdge,
+ Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
+ Tk_SizeOfBitmap(menuPtr->display,bitmap, &width, &height);
+ XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0, (unsigned) width,
+ (unsigned) height, leftEdge,
(int) (y + (mePtr->height - height)/2), 1);
} else {
if (mePtr->labelLength > 0) {
- Tk_DrawChars(menuPtr->display, d, gc,
- tkfont, mePtr->label, mePtr->labelLength,
- leftEdge, baseline);
+ char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, label,
+ mePtr->labelLength, leftEdge, baseline);
DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y,
width, height);
}
}
- if (mePtr->state == tkDisabledUid) {
- if (menuPtr->disabledFg == NULL) {
+ if (mePtr->state == ENTRY_DISABLED) {
+ if (menuPtr->disabledFgPtr == NULL) {
XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y,
(unsigned) width, (unsigned) height);
} else if ((mePtr->image != NULL)
@@ -768,15 +796,24 @@ DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
int height;
{
int indicatorSpace = mePtr->indicatorSpace;
+
if (mePtr->underline >= 0) {
- int leftEdge = x + indicatorSpace + menuPtr->activeBorderWidth;
+ int activeBorderWidth;
+ int leftEdge;
+ char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+ char *start = Tcl_UtfAtIndex(label, mePtr->underline);
+ char *end = Tcl_UtfNext(start);
+
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
+ menuPtr->activeBorderWidthPtr, &activeBorderWidth);
+ leftEdge = x + indicatorSpace + activeBorderWidth;
if (menuPtr->menuType == MENUBAR) {
leftEdge += 5;
}
-
- Tk_UnderlineChars(menuPtr->display, d, gc, tkfont, mePtr->label,
+
+ Tk_UnderlineChars(menuPtr->display, d, gc, tkfont, label,
leftEdge, y + (height + fmPtr->ascent - fmPtr->descent) / 2,
- mePtr->underline, mePtr->underline + 1);
+ start - label, end - label);
}
}
@@ -866,7 +903,7 @@ GetTearoffEntryGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*widthPtr = 0;
} else {
*heightPtr = fmPtr->linespace;
- *widthPtr = Tk_TextWidth(tkfont, "W", -1);
+ *widthPtr = Tk_TextWidth(tkfont, "W", 1);
}
}
@@ -897,29 +934,39 @@ TkpComputeMenubarGeometry(menuPtr)
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
int width, height;
int i, j;
- int x, y, currentRowHeight, currentRowWidth, maxWidth;
+ int x, y, currentRowHeight, maxWidth;
int maxWindowWidth;
int lastRowBreak;
int helpMenuIndex = -1;
TkMenuEntry *mePtr;
int lastEntry;
+ Tk_Font menuFont;
+ int borderWidth;
+ int activeBorderWidth;
if (menuPtr->tkwin == NULL) {
return;
}
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ &borderWidth);
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
+ &activeBorderWidth);
maxWidth = 0;
if (menuPtr->numEntries == 0) {
height = 0;
} else {
+ int borderWidth;
+
maxWindowWidth = Tk_Width(menuPtr->tkwin);
if (maxWindowWidth == 1) {
maxWindowWidth = 0x7ffffff;
}
currentRowHeight = 0;
- x = y = menuPtr->borderWidth;
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ &borderWidth);
+ x = y = borderWidth;
lastRowBreak = 0;
- currentRowWidth = 0;
/*
* On the Mac especially, getting font metrics can be quite slow,
@@ -929,21 +976,22 @@ TkpComputeMenubarGeometry(menuPtr)
* and if an entry has a font set, we will measure it as we come
* to it, and then we decide which set to give the geometry routines.
*/
-
- Tk_GetFontMetrics(menuPtr->tkfont, &menuMetrics);
+
+ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
+ Tk_GetFontMetrics(menuFont, &menuMetrics);
for (i = 0; i < menuPtr->numEntries; i++) {
mePtr = menuPtr->entries[i];
mePtr->entryFlags &= ~ENTRY_LAST_COLUMN;
- tkfont = mePtr->tkfont;
- if (tkfont == NULL) {
- tkfont = menuPtr->tkfont;
- fmPtr = &menuMetrics;
- } else {
+ if (mePtr->fontPtr != NULL) {
+ tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr);
Tk_GetFontMetrics(tkfont, &entryMetrics);
fmPtr = &entryMetrics;
+ } else {
+ tkfont = menuFont;
+ fmPtr = &menuMetrics;
}
-
+
/*
* For every entry, we need to check to see whether or not we
* wrap. If we do wrap, then we have to adjust all of the previous
@@ -956,24 +1004,21 @@ TkpComputeMenubarGeometry(menuPtr)
|| (mePtr->type == TEAROFF_ENTRY)) {
mePtr->height = mePtr->width = 0;
} else {
-
- GetMenuLabelGeometry(mePtr, tkfont, fmPtr,
- &width, &height);
- mePtr->height = height + 2 * menuPtr->activeBorderWidth + 10;
+ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, &width, &height);
+ mePtr->height = height + 2 * activeBorderWidth + 10;
mePtr->width = width;
-
- GetMenuIndicatorGeometry(menuPtr, mePtr,
- tkfont, fmPtr, &width, &height);
+
+ GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont, fmPtr,
+ &width, &height);
mePtr->indicatorSpace = width;
if (width > 0) {
mePtr->width += width;
}
- mePtr->width += 2 * menuPtr->activeBorderWidth + 10;
+ mePtr->width += 2 * activeBorderWidth + 10;
}
if (mePtr->entryFlags & ENTRY_HELP_MENU) {
helpMenuIndex = i;
- } else if (x + mePtr->width + menuPtr->borderWidth
- > maxWindowWidth) {
+ } else if (x + mePtr->width + borderWidth > maxWindowWidth) {
if (i == lastRowBreak) {
mePtr->y = y;
@@ -982,7 +1027,7 @@ TkpComputeMenubarGeometry(menuPtr)
y += mePtr->height;
currentRowHeight = 0;
} else {
- x = menuPtr->borderWidth;
+ x = borderWidth;
for (j = lastRowBreak; j < i; j++) {
menuPtr->entries[j]->y = y + currentRowHeight
- menuPtr->entries[j]->height;
@@ -996,7 +1041,7 @@ TkpComputeMenubarGeometry(menuPtr)
if (x > maxWidth) {
maxWidth = x;
}
- x = menuPtr->borderWidth;
+ x = borderWidth;
} else {
x += mePtr->width;
if (mePtr->height > currentRowHeight) {
@@ -1010,11 +1055,10 @@ TkpComputeMenubarGeometry(menuPtr)
lastEntry--;
}
if ((lastEntry >= 0) && (x + menuPtr->entries[lastEntry]->width
- + menuPtr->borderWidth > maxWidth)) {
- maxWidth = x + menuPtr->entries[lastEntry]->width
- + menuPtr->borderWidth;
+ + borderWidth > maxWidth)) {
+ maxWidth = x + menuPtr->entries[lastEntry]->width + borderWidth;
}
- x = menuPtr->borderWidth;
+ x = borderWidth;
for (j = lastRowBreak; j < menuPtr->numEntries; j++) {
if (j == helpMenuIndex) {
continue;
@@ -1028,17 +1072,17 @@ TkpComputeMenubarGeometry(menuPtr)
if (helpMenuIndex != -1) {
mePtr = menuPtr->entries[helpMenuIndex];
- if (x + mePtr->width + menuPtr->borderWidth > maxWindowWidth) {
+ if (x + mePtr->width + borderWidth > maxWindowWidth) {
y += currentRowHeight;
currentRowHeight = mePtr->height;
- x = menuPtr->borderWidth;
+ x = borderWidth;
} else if (mePtr->height > currentRowHeight) {
currentRowHeight = mePtr->height;
}
- mePtr->x = maxWindowWidth - menuPtr->borderWidth - mePtr->width;
+ mePtr->x = maxWindowWidth - borderWidth - mePtr->width;
mePtr->y = y + currentRowHeight - mePtr->height;
}
- height = y + currentRowHeight + menuPtr->borderWidth;
+ height = y + currentRowHeight + borderWidth;
}
width = Tk_Width(menuPtr->tkwin);
@@ -1088,27 +1132,28 @@ DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
int height;
{
XPoint points[2];
- int margin, segmentWidth, maxX;
+ int segmentWidth, maxX;
+ Tk_3DBorder border;
if (menuPtr->menuType != MASTER_MENU) {
return;
}
- margin = (fmPtr->ascent + fmPtr->descent)/2;
points[0].x = x;
points[0].y = y + height/2;
points[1].y = points[0].y;
segmentWidth = 6;
maxX = width - 1;
+ border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr);
while (points[0].x < maxX) {
points[1].x = points[0].x + segmentWidth;
if (points[1].x > maxX) {
points[1].x = maxX;
}
- Tk_Draw3DPolygon(menuPtr->tkwin, d, menuPtr->border, points, 2, 1,
+ Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 2, 1,
TK_RELIEF_RAISED);
- points[0].x += 2*segmentWidth;
+ points[0].x += 2 * segmentWidth;
}
}
@@ -1235,8 +1280,7 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
* Choose the gc for drawing the foreground part of the entry.
*/
- if ((mePtr->state == tkActiveUid)
- && !strictMotif) {
+ if ((mePtr->state == ENTRY_ACTIVE) && !strictMotif) {
gc = mePtr->activeGC;
if (gc == NULL) {
gc = menuPtr->activeGC;
@@ -1248,17 +1292,21 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
for (cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr != NULL;
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
- if (strcmp(cascadeEntryPtr->name,
- Tk_PathName(menuPtr->tkwin)) == 0) {
- if (cascadeEntryPtr->state == tkDisabledUid) {
- parentDisabled = 1;
+ if (cascadeEntryPtr->namePtr != NULL) {
+ char *name = Tcl_GetStringFromObj(cascadeEntryPtr->namePtr,
+ NULL);
+
+ if (strcmp(name, Tk_PathName(menuPtr->tkwin)) == 0) {
+ if (cascadeEntryPtr->state == ENTRY_DISABLED) {
+ parentDisabled = 1;
+ }
+ break;
}
- break;
}
}
- if (((parentDisabled || (mePtr->state == tkDisabledUid)))
- && (menuPtr->disabledFg != NULL)) {
+ if (((parentDisabled || (mePtr->state == ENTRY_DISABLED)))
+ && (menuPtr->disabledFgPtr != NULL)) {
gc = mePtr->disabledGC;
if (gc == NULL) {
gc = menuPtr->disabledGC;
@@ -1274,24 +1322,22 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
if (indicatorGC == NULL) {
indicatorGC = menuPtr->indicatorGC;
}
-
- bgBorder = mePtr->border;
- if (bgBorder == NULL) {
- bgBorder = menuPtr->border;
- }
+
+ bgBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
+ (mePtr->borderPtr == NULL)
+ ? menuPtr->borderPtr : mePtr->borderPtr);
if (strictMotif) {
activeBorder = bgBorder;
} else {
- activeBorder = mePtr->activeBorder;
- if (activeBorder == NULL) {
- activeBorder = menuPtr->activeBorder;
- }
+ activeBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
+ (mePtr->activeBorderPtr == NULL)
+ ? menuPtr->activeBorderPtr : mePtr->activeBorderPtr);
}
- if (mePtr->tkfont == NULL) {
+ if (mePtr->fontPtr == NULL) {
fmPtr = menuMetricsPtr;
} else {
- tkfont = mePtr->tkfont;
+ tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr);
Tk_GetFontMetrics(tkfont, &entryMetrics);
fmPtr = &entryMetrics;
}
@@ -1354,13 +1400,16 @@ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr)
if (mePtr->image != NULL) {
Tk_SizeOfImage(mePtr->image, widthPtr, heightPtr);
- } else if (mePtr->bitmap != (Pixmap) NULL) {
- Tk_SizeOfBitmap(menuPtr->display, mePtr->bitmap, widthPtr, heightPtr);
+ } else if (mePtr->bitmapPtr != NULL) {
+ Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
+ Tk_SizeOfBitmap(menuPtr->display, bitmap, widthPtr, heightPtr);
} else {
*heightPtr = fmPtr->linespace;
- if (mePtr->label != NULL) {
- *widthPtr = Tk_TextWidth(tkfont, mePtr->label, mePtr->labelLength);
+ if (mePtr->labelPtr != NULL) {
+ char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+
+ *widthPtr = Tk_TextWidth(tkfont, label, mePtr->labelLength);
} else {
*widthPtr = 0;
}
@@ -1392,18 +1441,23 @@ TkpComputeStandardMenuGeometry(
menuPtr) /* Structure describing menu. */
TkMenu *menuPtr;
{
- Tk_Font tkfont;
+ Tk_Font tkfont, menuFont;
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
int x, y, height, width, indicatorSpace, labelWidth, accelWidth;
int windowWidth, windowHeight, accelSpace;
int i, j, lastColumnBreak = 0;
TkMenuEntry *mePtr;
+ int borderWidth, activeBorderWidth;
if (menuPtr->tkwin == NULL) {
return;
}
- x = y = menuPtr->borderWidth;
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ &borderWidth);
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
+ &activeBorderWidth);
+ x = y = borderWidth;
indicatorSpace = labelWidth = accelWidth = 0;
windowHeight = windowWidth = 0;
@@ -1418,20 +1472,21 @@ TkpComputeStandardMenuGeometry(
* give all of the geometry/drawing the entry's font and metrics.
*/
- Tk_GetFontMetrics(menuPtr->tkfont, &menuMetrics);
- accelSpace = Tk_TextWidth(menuPtr->tkfont, "M", 1);
+ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
+ Tk_GetFontMetrics(menuFont, &menuMetrics);
+ accelSpace = Tk_TextWidth(menuFont, "M", 1);
for (i = 0; i < menuPtr->numEntries; i++) {
mePtr = menuPtr->entries[i];
- tkfont = mePtr->tkfont;
- if (tkfont == NULL) {
- tkfont = menuPtr->tkfont;
- fmPtr = &menuMetrics;
- } else {
- Tk_GetFontMetrics(tkfont, &entryMetrics);
- fmPtr = &entryMetrics;
- }
-
+ if (mePtr->fontPtr == NULL) {
+ tkfont = menuFont;
+ fmPtr = &menuMetrics;
+ } else {
+ tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr);
+ Tk_GetFontMetrics(tkfont, &entryMetrics);
+ fmPtr = &entryMetrics;
+ }
+
if ((i > 0) && mePtr->columnBreak) {
if (accelWidth != 0) {
labelWidth += accelSpace;
@@ -1440,16 +1495,16 @@ TkpComputeStandardMenuGeometry(
menuPtr->entries[j]->indicatorSpace = indicatorSpace;
menuPtr->entries[j]->labelWidth = labelWidth;
menuPtr->entries[j]->width = indicatorSpace + labelWidth
- + accelWidth + 2 * menuPtr->activeBorderWidth;
+ + accelWidth + 2 * activeBorderWidth;
menuPtr->entries[j]->x = x;
menuPtr->entries[j]->entryFlags &= ~ENTRY_LAST_COLUMN;
}
x += indicatorSpace + labelWidth + accelWidth
- + 2 * menuPtr->activeBorderWidth;
+ + 2 * activeBorderWidth;
windowWidth = x;
indicatorSpace = labelWidth = accelWidth = 0;
lastColumnBreak = i;
- y = menuPtr->borderWidth;
+ y = borderWidth;
}
if (mePtr->type == SEPARATOR_ENTRY) {
@@ -1507,8 +1562,7 @@ TkpComputeStandardMenuGeometry(
indicatorSpace = width;
}
- mePtr->height += 2 * menuPtr->activeBorderWidth +
- MENU_DIVIDER_HEIGHT;
+ mePtr->height += 2 * activeBorderWidth + MENU_DIVIDER_HEIGHT;
}
mePtr->y = y;
y += mePtr->height;
@@ -1524,15 +1578,15 @@ TkpComputeStandardMenuGeometry(
menuPtr->entries[j]->indicatorSpace = indicatorSpace;
menuPtr->entries[j]->labelWidth = labelWidth;
menuPtr->entries[j]->width = indicatorSpace + labelWidth
- + accelWidth + 2 * menuPtr->activeBorderWidth;
+ + accelWidth + 2 * activeBorderWidth;
menuPtr->entries[j]->x = x;
menuPtr->entries[j]->entryFlags |= ENTRY_LAST_COLUMN;
}
windowWidth = x + indicatorSpace + labelWidth + accelWidth
- + 2 * menuPtr->activeBorderWidth + 2 * menuPtr->borderWidth;
+ + 2 * activeBorderWidth + 2 * borderWidth;
- windowHeight += menuPtr->borderWidth;
+ windowHeight += borderWidth;
/*
* The X server doesn't like zero dimensions, so round up to at least
@@ -1601,3 +1655,31 @@ TkpMenuInit()
* Nothing to do.
*/
}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpMenuThreadInit --
+ *
+ * Does platform-specific initialization of thread-specific
+ * menu state.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpMenuThreadInit()
+{
+ /*
+ * Nothing to do.
+ */
+}
+
+
diff --git a/tk/unix/tkUnixMenubu.c b/tk/unix/tkUnixMenubu.c
index ac7c8796ceb..c188af991ae 100644
--- a/tk/unix/tkUnixMenubu.c
+++ b/tk/unix/tkUnixMenubu.c
@@ -84,10 +84,11 @@ TkpDisplayMenuButton(clientData)
return;
}
- if ((mbPtr->state == tkDisabledUid) && (mbPtr->disabledFg != NULL)) {
+ if ((mbPtr->state == STATE_DISABLED) && (mbPtr->disabledFg != NULL)) {
gc = mbPtr->disabledGC;
border = mbPtr->normalBorder;
- } else if ((mbPtr->state == tkActiveUid) && !Tk_StrictMotif(mbPtr->tkwin)) {
+ } else if ((mbPtr->state == STATE_ACTIVE)
+ && !Tk_StrictMotif(mbPtr->tkwin)) {
gc = mbPtr->activeTextGC;
border = mbPtr->activeBorder;
} else {
@@ -142,8 +143,8 @@ TkpDisplayMenuButton(clientData)
* foreground color, generate the stippled effect.
*/
- if ((mbPtr->state == tkDisabledUid)
- && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) {
+ if ((mbPtr->state == STATE_DISABLED)
+ && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) {
XFillRectangle(mbPtr->display, pixmap, mbPtr->disabledGC,
mbPtr->inset, mbPtr->inset,
(unsigned) (Tk_Width(tkwin) - 2*mbPtr->inset),
@@ -248,7 +249,7 @@ TkpDestroyMenuButton(mbPtr)
void
TkpComputeMenuButtonGeometry(mbPtr)
- register TkMenuButton *mbPtr; /* Widget record for menu button. */
+ TkMenuButton *mbPtr; /* Widget record for menu button. */
{
int width, height, mm, pixels;
@@ -305,3 +306,4 @@ TkpComputeMenuButtonGeometry(mbPtr)
(int) (height + 2*mbPtr->inset));
Tk_SetInternalBorder(mbPtr->tkwin, mbPtr->inset);
}
+
diff --git a/tk/unix/tkUnixPort.h b/tk/unix/tkUnixPort.h
index 1b3fcbe2132..46951b67133 100644
--- a/tk/unix/tkUnixPort.h
+++ b/tk/unix/tkUnixPort.h
@@ -7,7 +7,6 @@
*
* Copyright (c) 1991-1993 The Regents of the University of California.
* Copyright (c) 1994-1996 Sun Microsystems, Inc.
- * Copyright (c) 1998 by Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -186,12 +185,12 @@ extern int errno;
* in any other header file.
*/
-extern void panic _ANSI_ARGS_(TCL_VARARGS(char *, string));
/*
* These functions do nothing under Unix, so we just eliminate calls to them.
*/
+#define TkpButtonSetDefaults(specPtr) {}
#define TkpDestroyButton(butPtr) {}
#define TkSelUpdateClipboard(a,b) {}
#define TkSetPixmapColormap(p,c) {}
@@ -231,6 +230,9 @@ extern void panic _ANSI_ARGS_(TCL_VARARGS(char *, string));
* that is needed for portability reasons.
*/
-EXTERN void TclpGetTime _ANSI_ARGS_((Tcl_Time *time));
+#ifndef _TCLINT
+#include <tclInt.h>
+#endif
#endif /* _UNIXPORT */
+
diff --git a/tk/unix/tkUnixScale.c b/tk/unix/tkUnixScale.c
index 6378c03b70e..a05bbbef37d 100644
--- a/tk/unix/tkUnixScale.c
+++ b/tk/unix/tkUnixScale.c
@@ -5,6 +5,7 @@
* widget.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright (c) 1998-2000 by Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -56,7 +57,9 @@ TkpCreateScale(tkwin)
*
* TkpDestroyScale --
*
- * Destroy a TkScale structure.
+ * Destroy a TkScale structure. It's necessary to do this with
+ * Tcl_EventuallyFree to allow the Tcl_Preserve(scalePtr) to work
+ * as expected in TkpDisplayScale. (hobbs)
*
* Results:
* None
@@ -71,7 +74,7 @@ void
TkpDestroyScale(scalePtr)
TkScale *scalePtr;
{
- ckfree((char *) scalePtr);
+ Tcl_EventuallyFree((ClientData) scalePtr, TCL_DYNAMIC);
}
/*
@@ -107,7 +110,7 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
{
Tk_Window tkwin = scalePtr->tkwin;
int x, y, width, height, shadowWidth;
- double tickValue;
+ double tickValue, tickInterval = scalePtr->tickInterval;
Tk_3DBorder sliderBorder;
/*
@@ -129,9 +132,22 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
* Display the tick marks.
*/
- if (scalePtr->tickInterval != 0) {
+ if (tickInterval != 0) {
+ double ticks, maxTicks;
+
+ /*
+ * Ensure that we will only draw enough of the tick values
+ * such that they don't overlap
+ */
+ ticks = fabs((scalePtr->toValue - scalePtr->fromValue)
+ / tickInterval);
+ maxTicks = (double) Tk_Height(tkwin)
+ / (double) scalePtr->fontHeight;
+ if (ticks > maxTicks) {
+ tickInterval *= (ticks / maxTicks);
+ }
for (tickValue = scalePtr->fromValue; ;
- tickValue += scalePtr->tickInterval) {
+ tickValue += tickInterval) {
/*
* The TkRoundToResolution call gets rid of accumulated
* round-off errors, if any.
@@ -177,7 +193,7 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
(unsigned) scalePtr->width,
(unsigned) (Tk_Height(tkwin) - 2*scalePtr->inset
- 2*scalePtr->borderWidth));
- if (scalePtr->state == tkActiveUid) {
+ if (scalePtr->state == STATE_ACTIVE) {
sliderBorder = scalePtr->activeBorder;
} else {
sliderBorder = scalePtr->bgBorder;
@@ -185,7 +201,7 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
width = scalePtr->width;
height = scalePtr->sliderLength/2;
x = scalePtr->vertTroughX + scalePtr->borderWidth;
- y = TkpValueToPixel(scalePtr, scalePtr->value) - height;
+ y = TkScaleValueToPixel(scalePtr, scalePtr->value) - height;
shadowWidth = scalePtr->borderWidth/2;
if (shadowWidth == 0) {
shadowWidth = 1;
@@ -210,8 +226,9 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr)
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
- scalePtr->tkfont, scalePtr->label, scalePtr->labelLength,
- scalePtr->vertLabelX, scalePtr->inset + (3*fm.ascent)/2);
+ scalePtr->tkfont, scalePtr->label,
+ scalePtr->labelLength, scalePtr->vertLabelX,
+ scalePtr->inset + (3*fm.ascent)/2);
}
}
@@ -252,7 +269,7 @@ DisplayVerticalValue(scalePtr, drawable, value, rightEdge)
Tk_FontMetrics fm;
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
- y = TkpValueToPixel(scalePtr, value) + fm.ascent/2;
+ y = TkScaleValueToPixel(scalePtr, value) + fm.ascent/2;
sprintf(valueString, scalePtr->format, value);
length = strlen(valueString);
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
@@ -305,7 +322,7 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
{
register Tk_Window tkwin = scalePtr->tkwin;
int x, y, width, height, shadowWidth;
- double tickValue;
+ double tickValue, tickInterval = scalePtr->tickInterval;
Tk_3DBorder sliderBorder;
/*
@@ -327,9 +344,25 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
* Display the tick marks.
*/
- if (scalePtr->tickInterval != 0) {
+ if (tickInterval != 0) {
+ char valueString[PRINT_CHARS];
+ double ticks, maxTicks;
+
+ /*
+ * Ensure that we will only draw enough of the tick values
+ * such that they don't overlap. We base this off the width that
+ * fromValue would take. Not exact, but better than no constraint.
+ */
+ ticks = fabs((scalePtr->toValue - scalePtr->fromValue)
+ / tickInterval);
+ sprintf(valueString, scalePtr->format, scalePtr->fromValue);
+ maxTicks = (double) Tk_Width(tkwin)
+ / (double) Tk_TextWidth(scalePtr->tkfont, valueString, -1);
+ if (ticks > maxTicks) {
+ tickInterval *= (ticks / maxTicks);
+ }
for (tickValue = scalePtr->fromValue; ;
- tickValue += scalePtr->tickInterval) {
+ tickValue += tickInterval) {
/*
* The TkRoundToResolution call gets rid of accumulated
* round-off errors, if any.
@@ -376,14 +409,14 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
(unsigned) (Tk_Width(tkwin) - 2*scalePtr->inset
- 2*scalePtr->borderWidth),
(unsigned) scalePtr->width);
- if (scalePtr->state == tkActiveUid) {
+ if (scalePtr->state == STATE_ACTIVE) {
sliderBorder = scalePtr->activeBorder;
} else {
sliderBorder = scalePtr->bgBorder;
}
width = scalePtr->sliderLength/2;
height = scalePtr->width;
- x = TkpValueToPixel(scalePtr, scalePtr->value) - width;
+ x = TkScaleValueToPixel(scalePtr, scalePtr->value) - width;
y += scalePtr->borderWidth;
shadowWidth = scalePtr->borderWidth/2;
if (shadowWidth == 0) {
@@ -409,8 +442,9 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr)
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC,
- scalePtr->tkfont, scalePtr->label, scalePtr->labelLength,
- scalePtr->inset + fm.ascent/2, scalePtr->horizLabelY + fm.ascent);
+ scalePtr->tkfont, scalePtr->label,
+ scalePtr->labelLength, scalePtr->inset + fm.ascent/2,
+ scalePtr->horizLabelY + fm.ascent);
}
}
@@ -450,7 +484,7 @@ DisplayHorizontalValue(scalePtr, drawable, value, top)
char valueString[PRINT_CHARS];
Tk_FontMetrics fm;
- x = TkpValueToPixel(scalePtr, value);
+ x = TkScaleValueToPixel(scalePtr, value);
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
y = top + fm.ascent;
sprintf(valueString, scalePtr->format, value);
@@ -502,6 +536,7 @@ TkpDisplayScale(clientData)
char string[PRINT_CHARS];
XRectangle drawnArea;
+ scalePtr->flags &= ~REDRAW_PENDING;
if ((scalePtr->tkwin == NULL) || !Tk_IsMapped(scalePtr->tkwin)) {
goto done;
}
@@ -509,23 +544,22 @@ TkpDisplayScale(clientData)
/*
* Invoke the scale's command if needed.
*/
-
Tcl_Preserve((ClientData) scalePtr);
- Tcl_Preserve((ClientData) interp);
if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) {
+ Tcl_Preserve((ClientData) interp);
sprintf(string, scalePtr->format, scalePtr->value);
- result = Tcl_VarEval(interp, scalePtr->command, " ", string,
- (char *) NULL);
+ result = Tcl_VarEval(interp, scalePtr->command, " ", string,
+ (char *) NULL);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
Tcl_BackgroundError(interp);
}
+ Tcl_Release((ClientData) interp);
}
- Tcl_Release((ClientData) interp);
scalePtr->flags &= ~INVOKE_COMMAND;
- if (scalePtr->tkwin == NULL) {
+ if (scalePtr->flags & SCALE_DELETED) {
Tcl_Release((ClientData) scalePtr);
- return;
+ goto done;
}
Tcl_Release((ClientData) scalePtr);
@@ -549,7 +583,7 @@ TkpDisplayScale(clientData)
* different.
*/
- if (scalePtr->vertical) {
+ if (scalePtr->orient == ORIENT_VERTICAL) {
DisplayVerticalScale(scalePtr, pixmap, &drawnArea);
} else {
DisplayHorizontalScale(scalePtr, pixmap, &drawnArea);
@@ -575,7 +609,8 @@ TkpDisplayScale(clientData)
if (scalePtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(scalePtr->highlightColorPtr, pixmap);
} else {
- gc = Tk_GCForColor(scalePtr->highlightBgColorPtr, pixmap);
+ gc = Tk_GCForColor(
+ Tk_3DBorderColor(scalePtr->highlightBorder), pixmap);
}
Tk_DrawFocusHighlight(tkwin, gc, scalePtr->highlightWidth, pixmap);
}
@@ -621,7 +656,7 @@ TkpScaleElement(scalePtr, x, y)
{
int sliderFirst;
- if (scalePtr->vertical) {
+ if (scalePtr->orient == ORIENT_VERTICAL) {
if ((x < scalePtr->vertTroughX)
|| (x >= (scalePtr->vertTroughX + 2*scalePtr->borderWidth +
scalePtr->width))) {
@@ -631,7 +666,7 @@ TkpScaleElement(scalePtr, x, y)
|| (y >= (Tk_Height(scalePtr->tkwin) - scalePtr->inset))) {
return OTHER;
}
- sliderFirst = TkpValueToPixel(scalePtr, scalePtr->value)
+ sliderFirst = TkScaleValueToPixel(scalePtr, scalePtr->value)
- scalePtr->sliderLength/2;
if (y < sliderFirst) {
return TROUGH1;
@@ -651,7 +686,7 @@ TkpScaleElement(scalePtr, x, y)
|| (x >= (Tk_Width(scalePtr->tkwin) - scalePtr->inset))) {
return OTHER;
}
- sliderFirst = TkpValueToPixel(scalePtr, scalePtr->value)
+ sliderFirst = TkScaleValueToPixel(scalePtr, scalePtr->value)
- scalePtr->sliderLength/2;
if (x < sliderFirst) {
return TROUGH1;
@@ -661,168 +696,3 @@ TkpScaleElement(scalePtr, x, y)
}
return TROUGH2;
}
-
-/*
- *--------------------------------------------------------------
- *
- * TkpSetScaleValue --
- *
- * This procedure changes the value of a scale and invokes
- * a Tcl command to reflect the current position of a scale
- *
- * Results:
- * None.
- *
- * Side effects:
- * A Tcl command is invoked, and an additional error-processing
- * command may also be invoked. The scale's slider is redrawn.
- *
- *--------------------------------------------------------------
- */
-
-void
-TkpSetScaleValue(scalePtr, value, setVar, invokeCommand)
- register TkScale *scalePtr; /* Info about widget. */
- double value; /* New value for scale. Gets adjusted
- * if it's off the scale. */
- int setVar; /* Non-zero means reflect new value through
- * to associated variable, if any. */
- int invokeCommand; /* Non-zero means invoked -command option
- * to notify of new value, 0 means don't. */
-{
- char string[PRINT_CHARS];
-
- value = TkRoundToResolution(scalePtr, value);
- if ((value < scalePtr->fromValue)
- ^ (scalePtr->toValue < scalePtr->fromValue)) {
- value = scalePtr->fromValue;
- }
- if ((value > scalePtr->toValue)
- ^ (scalePtr->toValue < scalePtr->fromValue)) {
- value = scalePtr->toValue;
- }
- if (scalePtr->flags & NEVER_SET) {
- scalePtr->flags &= ~NEVER_SET;
- } else if (scalePtr->value == value) {
- return;
- }
- scalePtr->value = value;
- if (invokeCommand) {
- scalePtr->flags |= INVOKE_COMMAND;
- }
- TkEventuallyRedrawScale(scalePtr, REDRAW_SLIDER);
-
- if (setVar && (scalePtr->varName != NULL)) {
- sprintf(string, scalePtr->format, scalePtr->value);
- scalePtr->flags |= SETTING_VAR;
- Tcl_SetVar(scalePtr->interp, scalePtr->varName, string,
- TCL_GLOBAL_ONLY);
- scalePtr->flags &= ~SETTING_VAR;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpPixelToValue --
- *
- * Given a pixel within a scale window, return the scale
- * reading corresponding to that pixel.
- *
- * Results:
- * A double-precision scale reading. If the value is outside
- * the legal range for the scale then it's rounded to the nearest
- * end of the scale.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-double
-TkpPixelToValue(scalePtr, x, y)
- register TkScale *scalePtr; /* Information about widget. */
- int x, y; /* Coordinates of point within
- * window. */
-{
- double value, pixelRange;
-
- if (scalePtr->vertical) {
- pixelRange = Tk_Height(scalePtr->tkwin) - scalePtr->sliderLength
- - 2*scalePtr->inset - 2*scalePtr->borderWidth;
- value = y;
- } else {
- pixelRange = Tk_Width(scalePtr->tkwin) - scalePtr->sliderLength
- - 2*scalePtr->inset - 2*scalePtr->borderWidth;
- value = x;
- }
-
- if (pixelRange <= 0) {
- /*
- * Not enough room for the slider to actually slide: just return
- * the scale's current value.
- */
-
- return scalePtr->value;
- }
- value -= scalePtr->sliderLength/2 + scalePtr->inset
- + scalePtr->borderWidth;
- value /= pixelRange;
- if (value < 0) {
- value = 0;
- }
- if (value > 1) {
- value = 1;
- }
- value = scalePtr->fromValue +
- value * (scalePtr->toValue - scalePtr->fromValue);
- return TkRoundToResolution(scalePtr, value);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkpValueToPixel --
- *
- * Given a reading of the scale, return the x-coordinate or
- * y-coordinate corresponding to that reading, depending on
- * whether the scale is vertical or horizontal, respectively.
- *
- * Results:
- * An integer value giving the pixel location corresponding
- * to reading. The value is restricted to lie within the
- * defined range for the scale.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkpValueToPixel(scalePtr, value)
- register TkScale *scalePtr; /* Information about widget. */
- double value; /* Reading of the widget. */
-{
- int y, pixelRange;
- double valueRange;
-
- valueRange = scalePtr->toValue - scalePtr->fromValue;
- pixelRange = (scalePtr->vertical ? Tk_Height(scalePtr->tkwin)
- : Tk_Width(scalePtr->tkwin)) - scalePtr->sliderLength
- - 2*scalePtr->inset - 2*scalePtr->borderWidth;
- if (valueRange == 0) {
- y = 0;
- } else {
- y = (int) ((value - scalePtr->fromValue) * pixelRange
- / valueRange + 0.5);
- if (y < 0) {
- y = 0;
- } else if (y > pixelRange) {
- y = pixelRange;
- }
- }
- y += scalePtr->sliderLength/2 + scalePtr->inset + scalePtr->borderWidth;
- return y;
-}
diff --git a/tk/unix/tkUnixScrlbr.c b/tk/unix/tkUnixScrlbr.c
index 6861ed33da2..7704250eb01 100644
--- a/tk/unix/tkUnixScrlbr.c
+++ b/tk/unix/tkUnixScrlbr.c
@@ -474,3 +474,4 @@ TkpScrollbarPosition(scrollPtr, x, y)
}
return BOTTOM_GAP;
}
+
diff --git a/tk/unix/tkUnixSelect.c b/tk/unix/tkUnixSelect.c
index e42da31d91c..d240b1e0f40 100644
--- a/tk/unix/tkUnixSelect.c
+++ b/tk/unix/tkUnixSelect.c
@@ -4,7 +4,7 @@
* This file contains X specific routines for manipulating
* selections.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -15,6 +15,19 @@
#include "tkInt.h"
#include "tkSelect.h"
+typedef struct ConvertInfo {
+ int offset; /* The starting byte offset into the selection
+ * for the next chunk; -1 means all data has
+ * been transferred for this conversion. -2
+ * means only the final zero-length transfer
+ * still has to be done. Otherwise it is the
+ * offset of the next chunk of data to
+ * transfer. */
+ Tcl_EncodingState state; /* The encoding state needed across chunks. */
+ char buffer[TCL_UTF_MAX]; /* A buffer to hold part of a UTF character
+ * that is split across chunks.*/
+} ConvertInfo;
+
/*
* When handling INCR-style selection retrievals, the selection owner
* uses the following data structure to communicate between the
@@ -31,17 +44,21 @@ typedef struct IncrInfo {
* MULTIPLE retrievals) or to a static
* array. */
unsigned long numConversions;
- /* Number of entries in offsets (same as
+ /* Number of entries in converts (same as
* # of pairs in multAtoms). */
- int *offsets; /* One entry for each pair in
- * multAtoms; -1 means all data has
- * been transferred for this
- * conversion. -2 means only the
- * final zero-length transfer still
- * has to be done. Otherwise it is the
- * offset of the next chunk of data
- * to transfer. This array is malloc-ed. */
- int numIncrs; /* Number of entries in offsets that
+ ConvertInfo *converts; /* One entry for each pair in multAtoms.
+ * This array is malloc-ed. */
+ char **tempBufs; /* One pointer for each pair in multAtoms;
+ * each pointer is either NULL, or it points
+ * to a small bit of character data that was
+ * left over from the previous chunk. */
+ Tcl_EncodingState *state; /* One state info per pair in multAtoms:
+ * State info for encoding conversions
+ * that span multiple buffers. */
+ int *flags; /* One state flag per pair in multAtoms:
+ * Encoding flags, set to TCL_ENCODING_START
+ * at the beginning of an INCR transfer. */
+ int numIncrs; /* Number of entries in converts that
* aren't -1 (i.e. # of INCR-mode transfers
* not yet completed). */
Tcl_TimerToken timeout; /* Token for timer procedure. */
@@ -57,9 +74,12 @@ typedef struct IncrInfo {
* retrievals currently pending. */
} IncrInfo;
-static IncrInfo *pendingIncrs = NULL;
- /* List of all incr structures
+
+typedef struct ThreadSpecificData {
+ IncrInfo *pendingIncrs; /* List of all incr structures
* currently active. */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
* Largest property that we'll accept when sending or receiving the
@@ -98,7 +118,7 @@ static void SelTimeoutProc _ANSI_ARGS_((ClientData clientData));
* Results:
* The return value is a standard Tcl return value.
* If an error occurs (such as no selection exists)
- * then an error message is left in interp->result.
+ * then an error message is left in the interp's result.
*
* Side effects:
* None.
@@ -147,7 +167,9 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
retr.clientData = clientData;
retr.result = -1;
retr.idleTime = 0;
+ retr.encFlags = TCL_ENCODING_START;
retr.nextPtr = pendingRetrievals;
+ Tcl_DStringInit(&retr.buf);
pendingRetrievals = &retr;
/*
@@ -192,6 +214,7 @@ TkSelGetSelection(interp, tkwin, selection, target, proc, clientData)
}
}
}
+ Tcl_DStringFree(&retr.buf);
return retr.result;
}
@@ -223,13 +246,19 @@ TkSelPropProc(eventPtr)
register XEvent *eventPtr; /* X PropertyChange event. */
{
register IncrInfo *incrPtr;
- int i, format;
+ int i, length, numItems, flags;
+ Tcl_Encoding encoding;
+ int srcLen, dstLen, result, srcRead, dstWrote, soFar;
+ Tcl_DString ds;
+ char *src, *dst;
Atom target, formatType;
register TkSelHandler *selPtr;
long buffer[TK_SEL_WORDS_AT_ONCE];
- int numItems;
char *propPtr;
+ TkDisplay *dispPtr = TkGetDisplay(eventPtr->xany.display);
Tk_ErrorHandler errorHandler;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* See if this event announces the deletion of a property being
@@ -240,91 +269,234 @@ TkSelPropProc(eventPtr)
if (eventPtr->xproperty.state != PropertyDelete) {
return;
}
- for (incrPtr = pendingIncrs; incrPtr != NULL;
+ for (incrPtr = tsdPtr->pendingIncrs; incrPtr != NULL;
incrPtr = incrPtr->nextPtr) {
if (incrPtr->reqWindow != eventPtr->xproperty.window) {
continue;
}
+
+ /*
+ * For each conversion that has been requested, handle any
+ * chunks that haven't been transmitted yet.
+ */
+
for (i = 0; i < incrPtr->numConversions; i++) {
if ((eventPtr->xproperty.atom != incrPtr->multAtoms[2*i + 1])
- || (incrPtr->offsets[i] == -1)){
+ || (incrPtr->converts[i].offset == -1)) {
continue;
}
target = incrPtr->multAtoms[2*i];
incrPtr->idleTime = 0;
+
+ /*
+ * Look for a matching selection handler.
+ */
+
for (selPtr = incrPtr->winPtr->selHandlerList; ;
selPtr = selPtr->nextPtr) {
if (selPtr == NULL) {
+ /*
+ * No handlers match, so mark the conversion as done.
+ */
+
incrPtr->multAtoms[2*i + 1] = None;
- incrPtr->offsets[i] = -1;
+ incrPtr->converts[i].offset = -1;
incrPtr->numIncrs --;
return;
}
if ((selPtr->target == target)
&& (selPtr->selection == incrPtr->selection)) {
- formatType = selPtr->format;
- if (incrPtr->offsets[i] == -2) {
- numItems = 0;
- ((char *) buffer)[0] = 0;
- } else {
- TkSelInProgress ip;
- ip.selPtr = selPtr;
- ip.nextPtr = pendingPtr;
- pendingPtr = &ip;
- numItems = (*selPtr->proc)(selPtr->clientData,
- incrPtr->offsets[i], (char *) buffer,
- TK_SEL_BYTES_AT_ONCE);
- pendingPtr = ip.nextPtr;
- if (ip.selPtr == NULL) {
- /*
- * The selection handler deleted itself.
- */
-
- return;
- }
- if (numItems > TK_SEL_BYTES_AT_ONCE) {
- panic("selection handler returned too many bytes");
- } else {
- if (numItems < 0) {
- numItems = 0;
- }
- }
- ((char *) buffer)[numItems] = '\0';
- }
- if (numItems < TK_SEL_BYTES_AT_ONCE) {
- if (numItems <= 0) {
- incrPtr->offsets[i] = -1;
- incrPtr->numIncrs--;
- } else {
- incrPtr->offsets[i] = -2;
- }
- } else {
- incrPtr->offsets[i] += numItems;
- }
- if (formatType == XA_STRING) {
- propPtr = (char *) buffer;
- format = 8;
- } else {
- propPtr = (char *) SelCvtToX((char *) buffer,
- formatType, (Tk_Window) incrPtr->winPtr,
- &numItems);
- format = 32;
+ break;
+ }
+ }
+
+ /*
+ * We found a handler, so get the next chunk from it.
+ */
+
+ formatType = selPtr->format;
+ if (incrPtr->converts[i].offset == -2) {
+ /*
+ * We already got the last chunk, so send a null chunk
+ * to indicate that we are finished.
+ */
+
+ numItems = 0;
+ length = 0;
+ } else {
+ TkSelInProgress ip;
+ ip.selPtr = selPtr;
+ ip.nextPtr = TkSelGetInProgress();
+ TkSelSetInProgress(&ip);
+
+ /*
+ * Copy any bytes left over from a partial character at the end
+ * of the previous chunk into the beginning of the buffer.
+ * Pass the rest of the buffer space into the selection
+ * handler.
+ */
+
+ length = strlen(incrPtr->converts[i].buffer);
+ strcpy((char *)buffer, incrPtr->converts[i].buffer);
+
+ numItems = (*selPtr->proc)(selPtr->clientData,
+ incrPtr->converts[i].offset,
+ ((char *) buffer) + length,
+ TK_SEL_BYTES_AT_ONCE - length);
+ TkSelSetInProgress(ip.nextPtr);
+ if (ip.selPtr == NULL) {
+ /*
+ * The selection handler deleted itself.
+ */
+
+ return;
+ }
+ if (numItems < 0) {
+ numItems = 0;
+ }
+ numItems += length;
+ if (numItems > TK_SEL_BYTES_AT_ONCE) {
+ panic("selection handler returned too many bytes");
+ }
+ }
+ ((char *) buffer)[numItems] = 0;
+
+ /*
+ * Encode the data using the proper format for each type.
+ */
+
+ if ((formatType == XA_STRING)
+ || (dispPtr
+ && (formatType == dispPtr->compoundTextAtom))) {
+ /*
+ * Set up the encoding state based on the format and whether
+ * this is the first and/or last chunk.
+ */
+
+ flags = 0;
+ if (incrPtr->converts[i].offset == 0) {
+ flags |= TCL_ENCODING_START;
+ }
+ if (numItems < TK_SEL_BYTES_AT_ONCE) {
+ flags |= TCL_ENCODING_END;
+ }
+ if (formatType == XA_STRING) {
+ encoding = Tcl_GetEncoding(NULL, "iso8859-1");
+ } else {
+ encoding = Tcl_GetEncoding(NULL, "iso2022");
+ }
+
+ /*
+ * Now convert the data.
+ */
+
+ src = (char *)buffer;
+ srcLen = numItems;
+ Tcl_DStringInit(&ds);
+ dst = Tcl_DStringValue(&ds);
+ dstLen = ds.spaceAvl - 1;
+
+
+ /*
+ * Now convert the data, growing the destination buffer
+ * as needed.
+ */
+
+ while (1) {
+ result = Tcl_UtfToExternal(NULL, encoding,
+ src, srcLen, flags,
+ &incrPtr->converts[i].state,
+ dst, dstLen, &srcRead, &dstWrote, NULL);
+ soFar = dst + dstWrote - Tcl_DStringValue(&ds);
+ flags &= ~TCL_ENCODING_START;
+ src += srcRead;
+ srcLen -= srcRead;
+ if (result != TCL_CONVERT_NOSPACE) {
+ Tcl_DStringSetLength(&ds, soFar);
+ break;
}
- errorHandler = Tk_CreateErrorHandler(
- eventPtr->xproperty.display, -1, -1, -1,
- (int (*)()) NULL, (ClientData) NULL);
- XChangeProperty(eventPtr->xproperty.display,
- eventPtr->xproperty.window,
- eventPtr->xproperty.atom, formatType,
- format, PropModeReplace,
- (unsigned char *) propPtr, numItems);
- Tk_DeleteErrorHandler(errorHandler);
- if (propPtr != (char *) buffer) {
- ckfree(propPtr);
+ if (Tcl_DStringLength(&ds) == 0) {
+ Tcl_DStringSetLength(&ds, dstLen);
}
- return;
+ Tcl_DStringSetLength(&ds,
+ 2 * Tcl_DStringLength(&ds) + 1);
+ dst = Tcl_DStringValue(&ds) + soFar;
+ dstLen = Tcl_DStringLength(&ds) - soFar - 1;
+ }
+ Tcl_DStringSetLength(&ds, soFar);
+
+ if (encoding) {
+ Tcl_FreeEncoding(encoding);
+ }
+
+ /*
+ * Set the property to the encoded string value.
+ */
+
+ errorHandler = Tk_CreateErrorHandler(
+ eventPtr->xproperty.display, -1, -1, -1,
+ (int (*)()) NULL, (ClientData) NULL);
+ XChangeProperty(eventPtr->xproperty.display,
+ eventPtr->xproperty.window,
+ eventPtr->xproperty.atom, formatType, 8,
+ PropModeReplace,
+ (unsigned char *) Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds));
+ Tk_DeleteErrorHandler(errorHandler);
+
+ /*
+ * Preserve any left-over bytes.
+ */
+
+ if (srcLen > TCL_UTF_MAX) {
+ panic("selection conversion left too many bytes unconverted");
+ }
+ memcpy(incrPtr->converts[i].buffer, src, (size_t) srcLen+1);
+ Tcl_DStringFree(&ds);
+ } else {
+ propPtr = (char *) SelCvtToX((char *) buffer,
+ formatType, (Tk_Window) incrPtr->winPtr,
+ &numItems);
+
+ /*
+ * Set the property to the encoded string value.
+ */
+
+ errorHandler = Tk_CreateErrorHandler(
+ eventPtr->xproperty.display, -1, -1, -1,
+ (int (*)()) NULL, (ClientData) NULL);
+ XChangeProperty(eventPtr->xproperty.display,
+ eventPtr->xproperty.window,
+ eventPtr->xproperty.atom, formatType, 8,
+ PropModeReplace,
+ (unsigned char *) Tcl_DStringValue(&ds), numItems);
+ Tk_DeleteErrorHandler(errorHandler);
+
+ ckfree(propPtr);
+ }
+
+ /*
+ * Compute the next offset value. If this was the last chunk,
+ * then set the offset to -2. If this was an empty chunk,
+ * then set the offset to -1 to indicate we are done.
+ */
+
+ if (numItems < TK_SEL_BYTES_AT_ONCE) {
+ if (numItems <= 0) {
+ incrPtr->converts[i].offset = -1;
+ incrPtr->numIncrs--;
+ } else {
+ incrPtr->converts[i].offset = -2;
}
+ } else {
+ /*
+ * Advance over the selection data that was consumed
+ * this time.
+ */
+
+ incrPtr->converts[i].offset += numItems - length;
}
+ return;
}
}
}
@@ -378,6 +550,7 @@ TkSelEventProc(tkwin, eventPtr)
Atom type;
int format, result;
unsigned long numItems, bytesAfter;
+ Tcl_DString ds;
for (retrPtr = pendingRetrievals; ; retrPtr = retrPtr->nextPtr) {
if (retrPtr == NULL) {
@@ -421,18 +594,45 @@ TkSelEventProc(tkwin, eventPtr)
}
if ((type == XA_STRING) || (type == dispPtr->textAtom)
|| (type == dispPtr->compoundTextAtom)) {
+ Tcl_Encoding encoding;
if (format != 8) {
- sprintf(retrPtr->interp->result,
- "bad format for string selection: wanted \"8\", got \"%d\"",
- format);
+ char buf[64 + TCL_INTEGER_SPACE];
+
+ sprintf(buf,
+ "bad format for string selection: wanted \"8\", got \"%d\"",
+ format);
+ Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
return;
}
interp = retrPtr->interp;
Tcl_Preserve((ClientData) interp);
+
+ /*
+ * Convert the X selection data into UTF before passing it
+ * to the selection callback. Note that the COMPOUND_TEXT
+ * uses a modified iso2022 encoding, not the current system
+ * encoding. For now we'll just blindly apply the iso2022
+ * encoding. This is probably wrong, but it's a placeholder
+ * until we figure out what we're really supposed to do. For
+ * STRING, we need to use Latin-1 instead. Again, it's not
+ * really the full iso8859-1 space, but this is close enough.
+ */
+
+ if (type == dispPtr->compoundTextAtom) {
+ encoding = Tcl_GetEncoding(NULL, "iso2022");
+ } else {
+ encoding = Tcl_GetEncoding(NULL, "iso8859-1");
+ }
+ Tcl_ExternalToUtfDString(encoding, propInfo, (int)numItems, &ds);
+ if (encoding) {
+ Tcl_FreeEncoding(encoding);
+ }
+
retrPtr->result = (*retrPtr->proc)(retrPtr->clientData,
- interp, propInfo);
- Tcl_Release((ClientData) interp);
+ interp, Tcl_DStringValue(&ds));
+ Tcl_DStringFree(&ds);
+ Tcl_Release((ClientData) interp);
} else if (type == dispPtr->incrAtom) {
/*
@@ -456,9 +656,12 @@ TkSelEventProc(tkwin, eventPtr)
char *string;
if (format != 32) {
- sprintf(retrPtr->interp->result,
- "bad format for selection: wanted \"32\", got \"%d\"",
- format);
+ char buf[64 + TCL_INTEGER_SPACE];
+
+ sprintf(buf,
+ "bad format for selection: wanted \"32\", got \"%d\"",
+ format);
+ Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
return;
}
@@ -580,6 +783,8 @@ ConvertSelection(winPtr, eventPtr)
Tk_ErrorHandler errorHandler;
TkSelectionInfo *infoPtr;
TkSelInProgress ip;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,-1,
(int (*)()) NULL, (ClientData) NULL);
@@ -657,8 +862,8 @@ ConvertSelection(winPtr, eventPtr)
* be returned below).
*/
- incr.offsets = (int *) ckalloc((unsigned)
- (incr.numConversions*sizeof(int)));
+ incr.converts = (ConvertInfo *) ckalloc((unsigned)
+ (incr.numConversions*sizeof(ConvertInfo)));
incr.numIncrs = 0;
for (i = 0; i < incr.numConversions; i++) {
Atom target, property, type;
@@ -669,7 +874,8 @@ ConvertSelection(winPtr, eventPtr)
target = incr.multAtoms[2*i];
property = incr.multAtoms[2*i + 1];
- incr.offsets[i] = -1;
+ incr.converts[i].offset = -1;
+ incr.converts[i].buffer[0] = '\0';
for (selPtr = winPtr->selHandlerList; selPtr != NULL;
selPtr = selPtr->nextPtr) {
@@ -694,12 +900,12 @@ ConvertSelection(winPtr, eventPtr)
}
} else {
ip.selPtr = selPtr;
- ip.nextPtr = pendingPtr;
- pendingPtr = &ip;
+ ip.nextPtr = TkSelGetInProgress();
+ TkSelSetInProgress(&ip);
type = selPtr->format;
numItems = (*selPtr->proc)(selPtr->clientData, 0,
(char *) buffer, TK_SEL_BYTES_AT_ONCE);
- pendingPtr = ip.nextPtr;
+ TkSelSetInProgress(ip.nextPtr);
if ((ip.selPtr == NULL) || (numItems < 0)) {
incr.multAtoms[2*i + 1] = None;
continue;
@@ -730,19 +936,42 @@ ConvertSelection(winPtr, eventPtr)
numItems = 1;
propPtr = (char *) buffer;
format = 32;
- incr.offsets[i] = 0;
- } else if (type == XA_STRING) {
- propPtr = (char *) buffer;
- format = 8;
+ incr.converts[i].offset = 0;
+ XChangeProperty(reply.display, reply.requestor,
+ property, type, format, PropModeReplace,
+ (unsigned char *) propPtr, numItems);
+ } else if ((type == XA_STRING)
+ || (type == winPtr->dispPtr->compoundTextAtom)) {
+ Tcl_DString ds;
+ Tcl_Encoding encoding;
+
+ /*
+ * STRING is Latin-1, COMPOUND_TEXT is an iso2022 variant.
+ * We need to convert the selection text into these external
+ * forms before modifying the property.
+ */
+
+ if (type == XA_STRING) {
+ encoding = Tcl_GetEncoding(NULL, "iso8859-1");
+ } else {
+ encoding = Tcl_GetEncoding(NULL, "iso2022");
+ }
+ Tcl_UtfToExternalDString(encoding, (char*)buffer, -1, &ds);
+ XChangeProperty(reply.display, reply.requestor,
+ property, type, 8, PropModeReplace,
+ (unsigned char *) Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds));
+ if (encoding) {
+ Tcl_FreeEncoding(encoding);
+ }
+ Tcl_DStringFree(&ds);
} else {
propPtr = (char *) SelCvtToX((char *) buffer,
type, (Tk_Window) winPtr, &numItems);
format = 32;
- }
- XChangeProperty(reply.display, reply.requestor,
- property, type, format, PropModeReplace,
- (unsigned char *) propPtr, numItems);
- if (propPtr != (char *) buffer) {
+ XChangeProperty(reply.display, reply.requestor,
+ property, type, format, PropModeReplace,
+ (unsigned char *) propPtr, numItems);
ckfree(propPtr);
}
}
@@ -761,8 +990,8 @@ ConvertSelection(winPtr, eventPtr)
incr.idleTime = 0;
incr.reqWindow = reply.requestor;
incr.time = infoPtr->time;
- incr.nextPtr = pendingIncrs;
- pendingIncrs = &incr;
+ incr.nextPtr = tsdPtr->pendingIncrs;
+ tsdPtr->pendingIncrs = &incr;
}
if (multiple) {
XChangeProperty(reply.display, reply.requestor, reply.property,
@@ -798,10 +1027,10 @@ ConvertSelection(winPtr, eventPtr)
-1, -1,-1, (int (*)()) NULL, (ClientData) NULL);
XSelectInput(reply.display, reply.requestor, 0L);
Tk_DeleteErrorHandler(errorHandler);
- if (pendingIncrs == &incr) {
- pendingIncrs = incr.nextPtr;
+ if (tsdPtr->pendingIncrs == &incr) {
+ tsdPtr->pendingIncrs = incr.nextPtr;
} else {
- for (incrPtr2 = pendingIncrs; incrPtr2 != NULL;
+ for (incrPtr2 = tsdPtr->pendingIncrs; incrPtr2 != NULL;
incrPtr2 = incrPtr2->nextPtr) {
if (incrPtr2->nextPtr == &incr) {
incrPtr2->nextPtr = incr.nextPtr;
@@ -815,7 +1044,7 @@ ConvertSelection(winPtr, eventPtr)
* All done. Cleanup and return.
*/
- ckfree((char *) incr.offsets);
+ ckfree((char *) incr.converts);
if (multiple) {
XFree((char *) incr.multAtoms);
}
@@ -860,11 +1089,13 @@ SelRcvIncrProc(clientData, eventPtr)
register XEvent *eventPtr; /* X PropertyChange event. */
{
register TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *) clientData;
- char *propInfo;
+ char *propInfo, *dst, *src;
Atom type;
- int format, result;
+ int format, result, srcLen, dstLen, srcRead, dstWrote, soFar;
unsigned long numItems, bytesAfter;
+ Tcl_DString *dstPtr, temp;
Tcl_Interp *interp;
+ Tcl_Encoding encoding;
if ((eventPtr->xproperty.atom != retrPtr->property)
|| (eventPtr->xproperty.state != PropertyNewValue)
@@ -885,34 +1116,120 @@ SelRcvIncrProc(clientData, eventPtr)
retrPtr->result = TCL_ERROR;
goto done;
}
- if (numItems == 0) {
- retrPtr->result = TCL_OK;
- } else if ((type == XA_STRING)
+ if ((type == XA_STRING)
|| (type == retrPtr->winPtr->dispPtr->textAtom)
|| (type == retrPtr->winPtr->dispPtr->compoundTextAtom)) {
if (format != 8) {
- Tcl_SetResult(retrPtr->interp, (char *) NULL, TCL_STATIC);
- sprintf(retrPtr->interp->result,
- "bad format for string selection: wanted \"8\", got \"%d\"",
- format);
+ char buf[64 + TCL_INTEGER_SPACE];
+
+ sprintf(buf,
+ "bad format for string selection: wanted \"8\", got \"%d\"",
+ format);
+ Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
goto done;
}
interp = retrPtr->interp;
Tcl_Preserve((ClientData) interp);
- result = (*retrPtr->proc)(retrPtr->clientData, interp, propInfo);
+
+ if (type == retrPtr->winPtr->dispPtr->compoundTextAtom) {
+ encoding = Tcl_GetEncoding(NULL, "iso2022");
+ } else {
+ encoding = Tcl_GetEncoding(NULL, "iso8859-1");
+ }
+
+ /*
+ * Check to see if there is any data left over from the previous
+ * chunk. If there is, copy the old data and the new data into
+ * a new buffer.
+ */
+
+ Tcl_DStringInit(&temp);
+ if (Tcl_DStringLength(&retrPtr->buf) > 0) {
+ Tcl_DStringAppend(&temp, Tcl_DStringValue(&retrPtr->buf),
+ Tcl_DStringLength(&retrPtr->buf));
+ if (numItems > 0) {
+ Tcl_DStringAppend(&temp, propInfo, (int)numItems);
+ }
+ src = Tcl_DStringValue(&temp);
+ srcLen = Tcl_DStringLength(&temp);
+ } else if (numItems == 0) {
+ /*
+ * There is no new data, so we're done.
+ */
+
+ retrPtr->result = TCL_OK;
+ goto done;
+ } else {
+ src = propInfo;
+ srcLen = numItems;
+ }
+
+ /*
+ * Set up the destination buffer so we can use as much space as
+ * is available.
+ */
+
+ dstPtr = &retrPtr->buf;
+ dst = Tcl_DStringValue(dstPtr);
+ dstLen = dstPtr->spaceAvl - 1;
+
+ /*
+ * Now convert the data, growing the destination buffer as needed.
+ */
+
+ while (1) {
+ result = Tcl_ExternalToUtf(NULL, encoding, src, srcLen,
+ retrPtr->encFlags, &retrPtr->encState,
+ dst, dstLen, &srcRead, &dstWrote, NULL);
+ soFar = dst + dstWrote - Tcl_DStringValue(dstPtr);
+ retrPtr->encFlags &= ~TCL_ENCODING_START;
+ src += srcRead;
+ srcLen -= srcRead;
+ if (result != TCL_CONVERT_NOSPACE) {
+ Tcl_DStringSetLength(dstPtr, soFar);
+ break;
+ }
+ if (Tcl_DStringLength(dstPtr) == 0) {
+ Tcl_DStringSetLength(dstPtr, dstLen);
+ }
+ Tcl_DStringSetLength(dstPtr, 2 * Tcl_DStringLength(dstPtr) + 1);
+ dst = Tcl_DStringValue(dstPtr) + soFar;
+ dstLen = Tcl_DStringLength(dstPtr) - soFar - 1;
+ }
+ Tcl_DStringSetLength(dstPtr, soFar);
+
+ result = (*retrPtr->proc)(retrPtr->clientData, interp,
+ Tcl_DStringValue(dstPtr));
Tcl_Release((ClientData) interp);
+
+ /*
+ * Copy any unused data into the destination buffer so we can
+ * pick it up next time around.
+ */
+
+ Tcl_DStringSetLength(dstPtr, 0);
+ Tcl_DStringAppend(dstPtr, src, srcLen);
+
+ Tcl_DStringFree(&temp);
+ if (encoding) {
+ Tcl_FreeEncoding(encoding);
+ }
if (result != TCL_OK) {
retrPtr->result = result;
}
+ } else if (numItems == 0) {
+ retrPtr->result = TCL_OK;
} else {
char *string;
if (format != 32) {
- Tcl_SetResult(retrPtr->interp, (char *) NULL, TCL_STATIC);
- sprintf(retrPtr->interp->result,
- "bad format for selection: wanted \"32\", got \"%d\"",
- format);
+ char buf[64 + TCL_INTEGER_SPACE];
+
+ sprintf(buf,
+ "bad format for selection: wanted \"32\", got \"%d\"",
+ format);
+ Tcl_SetResult(retrPtr->interp, buf, TCL_VOLATILE);
retrPtr->result = TCL_ERROR;
goto done;
}
@@ -964,8 +1281,8 @@ SelectionSize(selPtr)
size = TK_SEL_BYTES_AT_ONCE;
ip.selPtr = selPtr;
- ip.nextPtr = pendingPtr;
- pendingPtr = &ip;
+ ip.nextPtr = TkSelGetInProgress();
+ TkSelSetInProgress(&ip);
do {
chunkSize = (*selPtr->proc)(selPtr->clientData, size,
(char *) buffer, TK_SEL_BYTES_AT_ONCE);
@@ -975,7 +1292,7 @@ SelectionSize(selPtr)
}
size += chunkSize;
} while (chunkSize == TK_SEL_BYTES_AT_ONCE);
- pendingPtr = ip.nextPtr;
+ TkSelSetInProgress(ip.nextPtr);
return size;
}
@@ -1187,3 +1504,4 @@ SelCvtFromX(propPtr, numValues, type, tkwin)
}
return result;
}
+
diff --git a/tk/unix/tkUnixSend.c b/tk/unix/tkUnixSend.c
index f9ce316a106..b661923e694 100644
--- a/tk/unix/tkUnixSend.c
+++ b/tk/unix/tkUnixSend.c
@@ -7,6 +7,7 @@
*
* Copyright (c) 1989-1994 The Regents of the University of California.
* Copyright (c) 1994-1996 Sun Microsystems, Inc.
+ * Copyright (c) 1998-1999 by Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -39,10 +40,6 @@ typedef struct RegisteredInterp {
* NULL means end of list. */
} RegisteredInterp;
-static RegisteredInterp *registry = NULL;
- /* List of all interpreters
- * registered by this process. */
-
/*
* A registry of all interpreters for a display is kept in a
* property "InterpRegistry" on the root window of the display.
@@ -109,9 +106,15 @@ typedef struct PendingCommand {
* list. */
} PendingCommand;
-static PendingCommand *pendingCommands = NULL;
- /* List of all commands currently
+typedef struct ThreadSpecificData {
+ PendingCommand *pendingCommands;
+ /* List of all commands currently
* being waited for. */
+ RegisteredInterp *interpListPtr;
+ /* List of all interpreters registered
+ * in the current process. */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
* The information below is used for communication between processes
@@ -255,7 +258,7 @@ static int ValidateName _ANSI_ARGS_((TkDisplay *dispPtr,
* If "lock" is set then the server will be locked. It is the
* caller's responsibility to call RegClose when finished with
* the registry, so that we can write back the registry if
- * neeeded, unlock the server if needed, and free memory.
+ * needed, unlock the server if needed, and free memory.
*
*----------------------------------------------------------------------
*/
@@ -745,18 +748,15 @@ Tk_SetAppName(tkwin, name)
RegisteredInterp *riPtr, *riPtr2;
Window w;
TkWindow *winPtr = (TkWindow *) tkwin;
- TkDisplay *dispPtr;
+ TkDisplay *dispPtr = winPtr->dispPtr;
NameRegistry *regPtr;
Tcl_Interp *interp;
char *actualName;
Tcl_DString dString;
int offset, i;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-#ifdef __WIN32__
- return name;
-#endif /* __WIN32__ */
-
- dispPtr = winPtr->dispPtr;
interp = winPtr->mainPtr->interp;
if (dispPtr->commTkwin == NULL) {
SendInit(interp, winPtr->dispPtr);
@@ -768,7 +768,7 @@ Tk_SetAppName(tkwin, name)
*/
regPtr = RegOpen(interp, winPtr->dispPtr, 1);
- for (riPtr = registry; ; riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; ; riPtr = riPtr->nextPtr) {
if (riPtr == NULL) {
/*
@@ -780,8 +780,9 @@ Tk_SetAppName(tkwin, name)
riPtr = (RegisteredInterp *) ckalloc(sizeof(RegisteredInterp));
riPtr->interp = interp;
riPtr->dispPtr = winPtr->dispPtr;
- riPtr->nextPtr = registry;
- registry = riPtr;
+ riPtr->nextPtr = tsdPtr->interpListPtr;
+ tsdPtr->interpListPtr = riPtr;
+ riPtr->name = NULL;
Tcl_CreateCommand(interp, "send", Tk_SendCmd, (ClientData) riPtr,
DeleteProc);
if (Tcl_IsSafe(interp)) {
@@ -795,8 +796,10 @@ Tk_SetAppName(tkwin, name)
* the name registry.
*/
- RegDeleteName(regPtr, riPtr->name);
- ckfree(riPtr->name);
+ if (riPtr->name) {
+ RegDeleteName(regPtr, riPtr->name);
+ ckfree(riPtr->name);
+ }
break;
}
}
@@ -835,7 +838,8 @@ Tk_SetAppName(tkwin, name)
*/
if (w == Tk_WindowId(dispPtr->commTkwin)) {
- for (riPtr2 = registry; riPtr2 != NULL; riPtr2 = riPtr2->nextPtr) {
+ for (riPtr2 = tsdPtr->interpListPtr; riPtr2 != NULL;
+ riPtr2 = riPtr2->nextPtr) {
if ((riPtr2->interp != interp) &&
(strcmp(riPtr2->name, actualName) == 0)) {
goto nextSuffix;
@@ -898,7 +902,7 @@ Tk_SendCmd(clientData, interp, argc, argv)
Window commWindow;
PendingCommand pending;
register RegisteredInterp *riPtr;
- char *destName, buffer[30];
+ char *destName;
int result, c, async, i, firstArg;
size_t length;
Tk_RestrictProc *prevRestrictProc;
@@ -907,6 +911,8 @@ Tk_SendCmd(clientData, interp, argc, argv)
Tcl_Time timeout;
NameRegistry *regPtr;
Tcl_DString request;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_Interp *localInterp; /* Used when the interpreter to
* send the command to is within
* the same process. */
@@ -968,7 +974,8 @@ Tk_SendCmd(clientData, interp, argc, argv)
* could be the same!
*/
- for (riPtr = registry; riPtr != NULL; riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
+ riPtr = riPtr->nextPtr) {
if ((riPtr->dispPtr != dispPtr)
|| (strcmp(riPtr->name, destName) != 0)) {
continue;
@@ -990,6 +997,7 @@ Tk_SendCmd(clientData, interp, argc, argv)
}
if (interp != localInterp) {
if (result == TCL_ERROR) {
+ Tcl_Obj *errorObjPtr;
/*
* An error occurred, so transfer error information from the
@@ -1003,17 +1011,11 @@ Tk_SendCmd(clientData, interp, argc, argv)
Tcl_ResetResult(interp);
Tcl_AddErrorInfo(interp, Tcl_GetVar2(localInterp,
"errorInfo", (char *) NULL, TCL_GLOBAL_ONLY));
- Tcl_SetVar2(interp, "errorCode", (char *) NULL,
- Tcl_GetVar2(localInterp, "errorCode", (char *) NULL,
- TCL_GLOBAL_ONLY), TCL_GLOBAL_ONLY);
+ errorObjPtr = Tcl_GetVar2Ex(localInterp, "errorCode", NULL,
+ TCL_GLOBAL_ONLY);
+ Tcl_SetObjErrorCode(interp, errorObjPtr);
}
- if (localInterp->freeProc != TCL_STATIC) {
- interp->result = localInterp->result;
- interp->freeProc = localInterp->freeProc;
- localInterp->freeProc = TCL_STATIC;
- } else {
- Tcl_SetResult(interp, localInterp->result, TCL_VOLATILE);
- }
+ Tcl_SetObjResult(interp, Tcl_GetObjResult(localInterp));
Tcl_ResetResult(localInterp);
}
Tcl_Release((ClientData) riPtr);
@@ -1044,6 +1046,8 @@ Tk_SendCmd(clientData, interp, argc, argv)
Tcl_DStringAppend(&request, "\0c\0-n ", 6);
Tcl_DStringAppend(&request, destName, -1);
if (!async) {
+ char buffer[TCL_INTEGER_SPACE * 2];
+
sprintf(buffer, "%x %d",
(unsigned int) Tk_WindowId(dispPtr->commTkwin),
tkSendSerial);
@@ -1087,8 +1091,8 @@ Tk_SendCmd(clientData, interp, argc, argv)
pending.errorInfo = NULL;
pending.errorCode = NULL;
pending.gotResponse = 0;
- pending.nextPtr = pendingCommands;
- pendingCommands = &pending;
+ pending.nextPtr = tsdPtr->pendingCommands;
+ tsdPtr->pendingCommands = &pending;
/*
* Enter a loop processing X events until the result comes
@@ -1136,10 +1140,10 @@ Tk_SendCmd(clientData, interp, argc, argv)
* and return the result.
*/
- if (pendingCommands != &pending) {
+ if (tsdPtr->pendingCommands != &pending) {
panic("Tk_SendCmd: corrupted send stack");
}
- pendingCommands = pending.nextPtr;
+ tsdPtr->pendingCommands = pending.nextPtr;
if (pending.errorInfo != NULL) {
/*
* Special trick: must clear the interp's result before calling
@@ -1153,8 +1157,9 @@ Tk_SendCmd(clientData, interp, argc, argv)
ckfree(pending.errorInfo);
}
if (pending.errorCode != NULL) {
- Tcl_SetVar2(interp, "errorCode", (char *) NULL, pending.errorCode,
- TCL_GLOBAL_ONLY);
+ Tcl_Obj *errorObjPtr;
+ errorObjPtr = Tcl_NewStringObj(pending.errorCode, -1);
+ Tcl_SetObjErrorCode(interp, errorObjPtr);
ckfree(pending.errorCode);
}
Tcl_SetResult(interp, pending.result, TCL_DYNAMIC);
@@ -1171,10 +1176,10 @@ Tk_SendCmd(clientData, interp, argc, argv)
* of a particular window.
*
* Results:
- * A standard Tcl return value. Interp->result will be set
+ * A standard Tcl return value. The interp's result will be set
* to hold a list of all the interpreter names defined for
* tkwin's display. If an error occurs, then TCL_ERROR
- * is returned and interp->result will hold an error message.
+ * is returned and the interp's result will hold an error message.
*
* Side effects:
* None.
@@ -1339,6 +1344,8 @@ SendEventProc(clientData, eventPtr)
unsigned long numItems, bytesAfter;
Atom actualType;
Tcl_Interp *remoteInterp; /* Interp in which to execute the command. */
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if ((eventPtr->xproperty.atom != dispPtr->commProperty)
|| (eventPtr->xproperty.state != PropertyNewValue)) {
@@ -1463,7 +1470,7 @@ SendEventProc(clientData, eventPtr)
* Locate the application, then execute the script.
*/
- for (riPtr = registry; ; riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; ; riPtr = riPtr->nextPtr) {
if (riPtr == NULL) {
if (commWindow != None) {
Tcl_DStringAppend(&reply,
@@ -1498,7 +1505,8 @@ SendEventProc(clientData, eventPtr)
*/
if (commWindow != None) {
- Tcl_DStringAppend(&reply, remoteInterp->result, -1);
+ Tcl_DStringAppend(&reply, Tcl_GetStringResult(remoteInterp),
+ -1);
if (result == TCL_ERROR) {
char *varValue;
@@ -1529,7 +1537,7 @@ SendEventProc(clientData, eventPtr)
returnResult:
if (commWindow != None) {
if (result != TCL_OK) {
- char buffer[20];
+ char buffer[TCL_INTEGER_SPACE];
sprintf(buffer, "%d", result);
Tcl_DStringAppend(&reply, "\0-c ", 4);
@@ -1604,7 +1612,7 @@ SendEventProc(clientData, eventPtr)
* waiting for it.
*/
- for (pcPtr = pendingCommands; pcPtr != NULL;
+ for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL;
pcPtr = pcPtr->nextPtr) {
if ((serial != pcPtr->serial) || (pcPtr->result != NULL)) {
continue;
@@ -1702,6 +1710,8 @@ AppendErrorProc(clientData, errorPtr)
{
PendingCommand *pendingPtr = (PendingCommand *) clientData;
register PendingCommand *pcPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (pendingPtr == NULL) {
return 0;
@@ -1711,7 +1721,7 @@ AppendErrorProc(clientData, errorPtr)
* Make sure this command is still pending.
*/
- for (pcPtr = pendingCommands; pcPtr != NULL;
+ for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL;
pcPtr = pcPtr->nextPtr) {
if ((pcPtr == pendingPtr) && (pcPtr->result == NULL)) {
pcPtr->result = (char *) ckalloc((unsigned)
@@ -1751,15 +1761,17 @@ DeleteProc(clientData)
RegisteredInterp *riPtr = (RegisteredInterp *) clientData;
register RegisteredInterp *riPtr2;
NameRegistry *regPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
regPtr = RegOpen(riPtr->interp, riPtr->dispPtr, 1);
RegDeleteName(regPtr, riPtr->name);
RegClose(regPtr);
- if (registry == riPtr) {
- registry = riPtr->nextPtr;
+ if (tsdPtr->interpListPtr == riPtr) {
+ tsdPtr->interpListPtr = riPtr->nextPtr;
} else {
- for (riPtr2 = registry; riPtr2 != NULL;
+ for (riPtr2 = tsdPtr->interpListPtr; riPtr2 != NULL;
riPtr2 = riPtr2->nextPtr) {
if (riPtr2->nextPtr == riPtr) {
riPtr2->nextPtr = riPtr->nextPtr;
@@ -1803,7 +1815,8 @@ SendRestrictProc(clientData, eventPtr)
if (eventPtr->type != PropertyNotify) {
return TK_DEFER_EVENT;
}
- for (dispPtr = tkDisplayList; dispPtr != NULL; dispPtr = dispPtr->nextPtr) {
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
+ dispPtr = dispPtr->nextPtr) {
if ((eventPtr->xany.display == dispPtr->display)
&& (eventPtr->xproperty.window
== Tk_WindowId(dispPtr->commTkwin))) {
@@ -1838,9 +1851,12 @@ UpdateCommWindow(dispPtr)
{
Tcl_DString names;
RegisteredInterp *riPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DStringInit(&names);
- for (riPtr = registry; riPtr != NULL; riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
+ riPtr = riPtr->nextPtr) {
Tcl_DStringAppendElement(&names, riPtr->name);
}
XChangeProperty(dispPtr->display, Tk_WindowId(dispPtr->commTkwin),
@@ -1849,3 +1865,4 @@ UpdateCommWindow(dispPtr)
Tcl_DStringLength(&names));
Tcl_DStringFree(&names);
}
+
diff --git a/tk/unix/tkUnixWm.c b/tk/unix/tkUnixWm.c
index 4251c52ab23..98e4861f044 100644
--- a/tk/unix/tkUnixWm.c
+++ b/tk/unix/tkUnixWm.c
@@ -8,7 +8,6 @@
*
* Copyright (c) 1991-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998 by Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -267,21 +266,10 @@ typedef struct TkWmInfo {
/*
* This module keeps a list of all top-level windows, primarily to
- * simplify the job of Tk_CoordsToWindow.
+ * simplify the job of Tk_CoordsToWindow. The list is called
+ * firstWmPtr and is stored in the TkDisplay structure.
*/
-static WmInfo *firstWmPtr = NULL; /* Points to first top-level window. */
-
-
-/*
- * The variable below is used to enable or disable tracing in this
- * module. If tracing is enabled, then information is printed on
- * standard output about interesting interactions with the window
- * manager.
- */
-
-static int wmTracing = 0;
-
/*
* The following structures are the official type records for geometry
* management of top-level and menubar windows.
@@ -337,6 +325,7 @@ static void ReparentEvent _ANSI_ARGS_((WmInfo *wmPtr,
XReparentEvent *eventPtr));
static void TopLevelReqProc _ANSI_ARGS_((ClientData dummy,
Tk_Window tkwin));
+static void UpdateCommand _ANSI_ARGS_((TkWindow *winPtr));
static void UpdateGeometryInfo _ANSI_ARGS_((
ClientData clientData));
static void UpdateHints _ANSI_ARGS_((TkWindow *winPtr));
@@ -378,6 +367,7 @@ TkWmNewWindow(winPtr)
TkWindow *winPtr; /* Newly-created top-level window. */
{
register WmInfo *wmPtr;
+ TkDisplay *dispPtr = winPtr->dispPtr;
wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo));
wmPtr->winPtr = winPtr;
@@ -433,8 +423,8 @@ TkWmNewWindow(winPtr)
wmPtr->cmdArgv = NULL;
wmPtr->clientMachine = NULL;
wmPtr->flags = WM_NEVER_MAPPED;
- wmPtr->nextPtr = firstWmPtr;
- firstWmPtr = wmPtr;
+ wmPtr->nextPtr = (WmInfo *) dispPtr->firstWmPtr;
+ dispPtr->firstWmPtr = wmPtr;
winPtr->wmInfoPtr = wmPtr;
UpdateVRootGeometry(wmPtr);
@@ -480,6 +470,8 @@ TkWmMapWindow(winPtr)
char *string;
if (wmPtr->flags & WM_NEVER_MAPPED) {
+ Tcl_DString ds;
+
wmPtr->flags &= ~WM_NEVER_MAPPED;
/*
@@ -498,16 +490,22 @@ TkWmMapWindow(winPtr)
*/
string = (wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid;
- if (XStringListToTextProperty(&string, 1, &textProp) != 0) {
+ Tcl_UtfToExternalDString(NULL, string, -1, &ds);
+ string = Tcl_DStringValue(&ds);
+ if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
+ &textProp) != 0) {
XSetWMName(winPtr->display, wmPtr->wrapperPtr->window, &textProp);
XFree((char *) textProp.value);
}
-
+ Tcl_DStringFree(&ds);
+
TkWmSetClass(winPtr);
if (wmPtr->iconName != NULL) {
+ Tcl_UtfToExternalDString(NULL, wmPtr->iconName, -1, &ds);
XSetIconName(winPtr->display, wmPtr->wrapperPtr->window,
- wmPtr->iconName);
+ Tcl_DStringValue(&ds));
+ Tcl_DStringFree(&ds);
}
if (wmPtr->master != None) {
@@ -519,16 +517,17 @@ TkWmMapWindow(winPtr)
UpdateHints(winPtr);
UpdateWmProtocols(wmPtr);
if (wmPtr->cmdArgv != NULL) {
- XSetCommand(winPtr->display, wmPtr->wrapperPtr->window,
- wmPtr->cmdArgv, wmPtr->cmdArgc);
+ UpdateCommand(winPtr);
}
if (wmPtr->clientMachine != NULL) {
- if (XStringListToTextProperty(&wmPtr->clientMachine, 1, &textProp)
- != 0) {
+ Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, -1, &ds);
+ if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
+ &textProp) != 0) {
XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window,
&textProp);
XFree((char *) textProp.value);
}
+ Tcl_DStringFree(&ds);
}
}
if (wmPtr->hints.initial_state == WithdrawnState) {
@@ -630,12 +629,13 @@ TkWmDeadWindow(winPtr)
if (wmPtr == NULL) {
return;
}
- if (firstWmPtr == wmPtr) {
- firstWmPtr = wmPtr->nextPtr;
+ if ((WmInfo *) winPtr->dispPtr->firstWmPtr == wmPtr) {
+ winPtr->dispPtr->firstWmPtr = wmPtr->nextPtr;
} else {
register WmInfo *prevPtr;
- for (prevPtr = firstWmPtr; ; prevPtr = prevPtr->nextPtr) {
+ for (prevPtr = (WmInfo *) winPtr->dispPtr->firstWmPtr; ;
+ prevPtr = prevPtr->nextPtr) {
if (prevPtr == NULL) {
panic("couldn't unlink window in TkWmDeadWindow");
}
@@ -740,13 +740,18 @@ TkWmSetClass(winPtr)
if (winPtr->classUid != NULL) {
XClassHint *classPtr;
+ Tcl_DString name, class;
+ Tcl_UtfToExternalDString(NULL, winPtr->nameUid, -1, &name);
+ Tcl_UtfToExternalDString(NULL, winPtr->classUid, -1, &class);
classPtr = XAllocClassHint();
- classPtr->res_name = winPtr->nameUid;
- classPtr->res_class = winPtr->classUid;
+ classPtr->res_name = Tcl_DStringValue(&name);
+ classPtr->res_class = Tcl_DStringValue(&class);
XSetClassHint(winPtr->display, winPtr->wmInfoPtr->wrapperPtr->window,
classPtr);
XFree((char *) classPtr);
+ Tcl_DStringFree(&name);
+ Tcl_DStringFree(&class);
}
}
@@ -781,6 +786,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
register WmInfo *wmPtr;
int c;
size_t length;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (argc < 2) {
wrongNumArgs:
@@ -798,10 +804,11 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (argc == 2) {
- interp->result = (wmTracing) ? "on" : "off";
+ Tcl_SetResult(interp, ((dispPtr->wmTracing) ? "on" : "off"),
+ TCL_STATIC);
return TCL_OK;
}
- return Tcl_GetBoolean(interp, argv[2], &wmTracing);
+ return Tcl_GetBoolean(interp, argv[2], &dispPtr->wmTracing);
}
if (argc < 3) {
@@ -828,9 +835,12 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->sizeHintsFlags & PAspect) {
- sprintf(interp->result, "%d %d %d %d", wmPtr->minAspect.x,
+ char buf[TCL_INTEGER_SPACE * 4];
+
+ sprintf(buf, "%d %d %d %d", wmPtr->minAspect.x,
wmPtr->minAspect.y, wmPtr->maxAspect.x,
wmPtr->maxAspect.y);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
}
return TCL_OK;
}
@@ -845,7 +855,8 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) ||
(denom2 <= 0)) {
- interp->result = "aspect number can't be <= 0";
+ Tcl_SetResult(interp, "aspect number can't be <= 0",
+ TCL_STATIC);
return TCL_ERROR;
}
wmPtr->minAspect.x = numer1;
@@ -866,7 +877,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->clientMachine != NULL) {
- interp->result = wmPtr->clientMachine;
+ Tcl_SetResult(interp, wmPtr->clientMachine, TCL_STATIC);
}
return TCL_OK;
}
@@ -890,12 +901,16 @@ Tk_WmCmd(clientData, interp, argc, argv)
strcpy(wmPtr->clientMachine, argv[3]);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
- if (XStringListToTextProperty(&wmPtr->clientMachine, 1, &textProp)
- != 0) {
+ Tcl_DString ds;
+
+ Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, -1, &ds);
+ if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
+ &textProp) != 0) {
XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window,
&textProp);
XFree((char *) textProp.value);
}
+ Tcl_DStringFree(&ds);
}
} else if ((c == 'c') && (strncmp(argv[1], "colormapwindows", length) == 0)
&& (length >= 3)) {
@@ -985,8 +1000,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->cmdArgv != NULL) {
- interp->result = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv);
- interp->freeProc = TCL_DYNAMIC;
+ Tcl_SetResult(interp,
+ Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv),
+ TCL_DYNAMIC);
}
return TCL_OK;
}
@@ -1010,8 +1026,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
wmPtr->cmdArgc = cmdArgc;
wmPtr->cmdArgv = cmdArgv;
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
- XSetCommand(winPtr->display, wmPtr->wrapperPtr->window,
- cmdArgv, cmdArgc);
+ UpdateCommand(winPtr);
}
} else if ((c == 'd') && (strncmp(argv[1], "deiconify", length) == 0)) {
if (argc != 3) {
@@ -1041,7 +1056,8 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (argc == 3) {
- interp->result = wmPtr->hints.input ? "passive" : "active";
+ Tcl_SetResult(interp, (wmPtr->hints.input ? "passive" : "active"),
+ TCL_STATIC);
return TCL_OK;
}
c = argv[3][0];
@@ -1059,6 +1075,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
} else if ((c == 'f') && (strncmp(argv[1], "frame", length) == 0)
&& (length >= 2)) {
Window window;
+ char buf[TCL_INTEGER_SPACE];
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # arguments: must be \"",
@@ -1069,7 +1086,8 @@ Tk_WmCmd(clientData, interp, argc, argv)
if (window == None) {
window = Tk_WindowId((Tk_Window) winPtr);
}
- sprintf(interp->result, "0x%x", (unsigned int) window);
+ sprintf(buf, "0x%x", (unsigned int) window);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
} else if ((c == 'g') && (strncmp(argv[1], "geometry", length) == 0)
&& (length >= 2)) {
char xSign, ySign;
@@ -1082,6 +1100,8 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (argc == 3) {
+ char buf[16 + TCL_INTEGER_SPACE * 4];
+
xSign = (wmPtr->flags & WM_NEGATIVE_X) ? '-' : '+';
ySign = (wmPtr->flags & WM_NEGATIVE_Y) ? '-' : '+';
if (wmPtr->gridWin != NULL) {
@@ -1093,8 +1113,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
width = winPtr->changes.width;
height = winPtr->changes.height;
}
- sprintf(interp->result, "%dx%d%c%d%c%d", width, height,
- xSign, wmPtr->x, ySign, wmPtr->y);
+ sprintf(buf, "%dx%d%c%d%c%d", width, height, xSign, wmPtr->x,
+ ySign, wmPtr->y);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
if (*argv[3] == '\0') {
@@ -1115,9 +1136,12 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->sizeHintsFlags & PBaseSize) {
- sprintf(interp->result, "%d %d %d %d", wmPtr->reqGridWidth,
+ char buf[TCL_INTEGER_SPACE * 4];
+
+ sprintf(buf, "%d %d %d %d", wmPtr->reqGridWidth,
wmPtr->reqGridHeight, wmPtr->widthInc,
wmPtr->heightInc);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
}
return TCL_OK;
}
@@ -1144,19 +1168,19 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (reqWidth < 0) {
- interp->result = "baseWidth can't be < 0";
+ Tcl_SetResult(interp, "baseWidth can't be < 0", TCL_STATIC);
return TCL_ERROR;
}
if (reqHeight < 0) {
- interp->result = "baseHeight can't be < 0";
+ Tcl_SetResult(interp, "baseHeight can't be < 0", TCL_STATIC);
return TCL_ERROR;
}
if (widthInc < 0) {
- interp->result = "widthInc can't be < 0";
+ Tcl_SetResult(interp, "widthInc can't be < 0", TCL_STATIC);
return TCL_ERROR;
}
if (heightInc < 0) {
- interp->result = "heightInc can't be < 0";
+ Tcl_SetResult(interp, "heightInc can't be < 0", TCL_STATIC);
return TCL_ERROR;
}
Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc,
@@ -1177,7 +1201,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->hints.flags & WindowGroupHint) {
- interp->result = wmPtr->leaderName;
+ Tcl_SetResult(interp, wmPtr->leaderName, TCL_STATIC);
}
return TCL_OK;
}
@@ -1204,6 +1228,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
if (wmPtr2->wrapperPtr == NULL) {
CreateWrapper(wmPtr2);
}
+ if (wmPtr->leaderName != NULL) {
+ ckfree(wmPtr->leaderName);
+ }
wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr);
wmPtr->hints.flags |= WindowGroupHint;
wmPtr->leaderName = ckalloc((unsigned) (strlen(argv[3])+1));
@@ -1222,8 +1249,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->hints.flags & IconPixmapHint) {
- interp->result = Tk_NameOfBitmap(winPtr->display,
- wmPtr->hints.icon_pixmap);
+ Tcl_SetResult(interp,
+ Tk_NameOfBitmap(winPtr->display, wmPtr->hints.icon_pixmap),
+ TCL_STATIC);
}
return TCL_OK;
}
@@ -1277,8 +1305,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
} else {
if (XIconifyWindow(winPtr->display, wmPtr->wrapperPtr->window,
winPtr->screenNum) == 0) {
- interp->result =
- "couldn't send iconify message to window manager";
+ Tcl_SetResult(interp,
+ "couldn't send iconify message to window manager",
+ TCL_STATIC);
return TCL_ERROR;
}
WaitForMapNotify(winPtr, 0);
@@ -1295,8 +1324,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->hints.flags & IconMaskHint) {
- interp->result = Tk_NameOfBitmap(winPtr->display,
- wmPtr->hints.icon_mask);
+ Tcl_SetResult(interp,
+ Tk_NameOfBitmap(winPtr->display, wmPtr->hints.icon_mask),
+ TCL_STATIC);
}
return TCL_OK;
}
@@ -1322,17 +1352,23 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (argc == 3) {
- interp->result = (wmPtr->iconName != NULL) ? wmPtr->iconName : "";
+ Tcl_SetResult(interp,
+ ((wmPtr->iconName != NULL) ? wmPtr->iconName : ""),
+ TCL_STATIC);
return TCL_OK;
} else {
if (wmPtr->iconName != NULL) {
- ckfree(wmPtr->iconName);
+ ckfree((char *) wmPtr->iconName);
}
wmPtr->iconName = ckalloc((unsigned) (strlen(argv[3]) + 1));
strcpy(wmPtr->iconName, argv[3]);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
+ Tcl_DString ds;
+
+ Tcl_UtfToExternalDString(NULL, wmPtr->iconName, -1, &ds);
XSetIconName(winPtr->display, wmPtr->wrapperPtr->window,
- wmPtr->iconName);
+ Tcl_DStringValue(&ds));
+ Tcl_DStringFree(&ds);
}
}
} else if ((c == 'i') && (strncmp(argv[1], "iconposition", length) == 0)
@@ -1347,8 +1383,11 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->hints.flags & IconPositionHint) {
- sprintf(interp->result, "%d %d", wmPtr->hints.icon_x,
+ char buf[TCL_INTEGER_SPACE * 2];
+
+ sprintf(buf, "%d %d", wmPtr->hints.icon_x,
wmPtr->hints.icon_y);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
}
return TCL_OK;
}
@@ -1378,7 +1417,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->icon != NULL) {
- interp->result = Tk_PathName(wmPtr->icon);
+ Tcl_SetResult(interp, Tk_PathName(wmPtr->icon), TCL_STATIC);
}
return TCL_OK;
}
@@ -1447,8 +1486,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
if (XWithdrawWindow(Tk_Display(tkwin2),
Tk_WindowId(wmPtr2->wrapperPtr),
Tk_ScreenNumber(tkwin2)) == 0) {
- interp->result =
- "couldn't send withdraw message to window manager";
+ Tcl_SetResult(interp,
+ "couldn't send withdraw message to window manager",
+ TCL_STATIC);
return TCL_ERROR;
}
WaitForMapNotify((TkWindow *) tkwin2, 0);
@@ -1464,8 +1504,11 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (argc == 3) {
+ char buf[TCL_INTEGER_SPACE * 2];
+
GetMaxSize(wmPtr, &width, &height);
- sprintf(interp->result, "%d %d", width, height);
+ sprintf(buf, "%d %d", width, height);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
if ((Tcl_GetInt(interp, argv[3], &width) != TCL_OK)
@@ -1485,8 +1528,10 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (argc == 3) {
- sprintf(interp->result, "%d %d", wmPtr->minWidth,
- wmPtr->minHeight);
+ char buf[TCL_INTEGER_SPACE * 2];
+
+ sprintf(buf, "%d %d", wmPtr->minWidth, wmPtr->minHeight);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
if ((Tcl_GetInt(interp, argv[3], &width) != TCL_OK)
@@ -1499,7 +1544,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
goto updateGeom;
} else if ((c == 'o')
&& (strncmp(argv[1], "overrideredirect", length) == 0)) {
- int boolean;
+ int boolean, curValue;
XSetWindowAttributes atts;
if ((argc != 3) && (argc != 4)) {
@@ -1508,24 +1553,27 @@ Tk_WmCmd(clientData, interp, argc, argv)
(char *) NULL);
return TCL_ERROR;
}
+ curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect;
if (argc == 3) {
- if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
- interp->result = "1";
- } else {
- interp->result = "0";
- }
+ Tcl_SetBooleanObj(Tcl_GetObjResult(interp), curValue);
return TCL_OK;
}
if (Tcl_GetBoolean(interp, argv[3], &boolean) != TCL_OK) {
return TCL_ERROR;
}
- atts.override_redirect = (boolean) ? True : False;
- Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect,
- &atts);
- if (winPtr->wmInfoPtr->wrapperPtr != NULL) {
- Tk_ChangeWindowAttributes(
+ if (curValue != boolean) {
+ /*
+ * Only do this if we are really changing value, because it
+ * causes some funky stuff to occur
+ */
+ atts.override_redirect = (boolean) ? True : False;
+ Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect,
+ &atts);
+ if (winPtr->wmInfoPtr->wrapperPtr != NULL) {
+ Tk_ChangeWindowAttributes(
(Tk_Window) winPtr->wmInfoPtr->wrapperPtr,
CWOverrideRedirect, &atts);
+ }
}
} else if ((c == 'p') && (strncmp(argv[1], "positionfrom", length) == 0)
&& (length >= 2)) {
@@ -1537,9 +1585,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->sizeHintsFlags & USPosition) {
- interp->result = "user";
+ Tcl_SetResult(interp, "user", TCL_STATIC);
} else if (wmPtr->sizeHintsFlags & PPosition) {
- interp->result = "program";
+ Tcl_SetResult(interp, "program", TCL_STATIC);
}
return TCL_OK;
}
@@ -1593,7 +1641,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
for (protPtr = wmPtr->protPtr; protPtr != NULL;
protPtr = protPtr->nextPtr) {
if (protPtr->protocol == protocol) {
- interp->result = protPtr->command;
+ Tcl_SetResult(interp, protPtr->command, TCL_STATIC);
return TCL_OK;
}
}
@@ -1640,9 +1688,12 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (argc == 3) {
- sprintf(interp->result, "%d %d",
+ char buf[TCL_INTEGER_SPACE * 2];
+
+ sprintf(buf, "%d %d",
(wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) ? 0 : 1,
(wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) ? 0 : 1);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
if ((Tcl_GetBoolean(interp, argv[3], &width) != TCL_OK)
@@ -1671,9 +1722,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->sizeHintsFlags & USSize) {
- interp->result = "user";
+ Tcl_SetResult(interp, "user", TCL_STATIC);
} else if (wmPtr->sizeHintsFlags & PSize) {
- interp->result = "program";
+ Tcl_SetResult(interp, "program", TCL_STATIC);
}
return TCL_OK;
}
@@ -1699,21 +1750,95 @@ Tk_WmCmd(clientData, interp, argc, argv)
goto updateGeom;
} else if ((c == 's') && (strncmp(argv[1], "state", length) == 0)
&& (length >= 2)) {
- if (argc != 3) {
+ if ((argc < 3) || (argc > 4)) {
Tcl_AppendResult(interp, "wrong # arguments: must be \"",
- argv[0], " state window\"", (char *) NULL);
+ argv[0], " state window ?state?\"", (char *) NULL);
return TCL_ERROR;
}
- if (wmPtr->iconFor != NULL) {
- interp->result = "icon";
- } else if (wmPtr->withdrawn) {
- interp->result = "withdrawn";
- } else if (Tk_IsMapped((Tk_Window) winPtr)
- || ((wmPtr->flags & WM_NEVER_MAPPED)
- && (wmPtr->hints.initial_state == NormalState))) {
- interp->result = "normal";
+ if (argc == 4) {
+ if (wmPtr->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't change state of ", argv[2],
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ c = argv[3][0];
+ length = strlen(argv[3]);
+
+ if ((c == 'n') && (strncmp(argv[3], "normal", length) == 0)) {
+ wmPtr->hints.initial_state = NormalState;
+ wmPtr->withdrawn = 0;
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return TCL_OK;
+ }
+ UpdateHints(winPtr);
+ Tk_MapWindow((Tk_Window) winPtr);
+ } else if ((c == 'i')
+ && (strncmp(argv[3], "iconic", length) == 0)) {
+ if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
+ Tcl_AppendResult(interp, "can't iconify \"",
+ winPtr->pathName,
+ "\": override-redirect flag is set",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+ if (wmPtr->master != None) {
+ Tcl_AppendResult(interp, "can't iconify \"",
+ winPtr->pathName,
+ "\": it is a transient", (char *) NULL);
+ return TCL_ERROR;
+ }
+ wmPtr->hints.initial_state = IconicState;
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return TCL_OK;
+ }
+ if (wmPtr->withdrawn) {
+ UpdateHints(winPtr);
+ Tk_MapWindow((Tk_Window) winPtr);
+ wmPtr->withdrawn = 0;
+ } else {
+ if (XIconifyWindow(winPtr->display,
+ wmPtr->wrapperPtr->window,
+ winPtr->screenNum) == 0) {
+ Tcl_SetResult(interp, "couldn't send iconify message to window manager", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ WaitForMapNotify(winPtr, 0);
+ }
+ } else if ((c == 'w')
+ && (strncmp(argv[3], "withdrawn", length) == 0)) {
+ wmPtr->hints.initial_state = WithdrawnState;
+ wmPtr->withdrawn = 1;
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return TCL_OK;
+ }
+ if (XWithdrawWindow(winPtr->display, wmPtr->wrapperPtr->window,
+ winPtr->screenNum) == 0) {
+ Tcl_SetResult(interp,
+ "couldn't send withdraw message to window manager",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+ WaitForMapNotify(winPtr, 0);
+ } else {
+ Tcl_AppendResult(interp, "bad argument \"", argv[3],
+ "\": must be normal, iconic or withdrawn",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
} else {
- interp->result = "iconic";
+ if (wmPtr->iconFor != NULL) {
+ Tcl_SetResult(interp, "icon", TCL_STATIC);
+ } else if (wmPtr->withdrawn) {
+ Tcl_SetResult(interp, "withdrawn", TCL_STATIC);
+ } else if (Tk_IsMapped((Tk_Window) winPtr)
+ || ((wmPtr->flags & WM_NEVER_MAPPED)
+ && (wmPtr->hints.initial_state == NormalState))) {
+ Tcl_SetResult(interp, "normal", TCL_STATIC);
+ } else {
+ Tcl_SetResult(interp, "iconic", TCL_STATIC);
+ }
}
} else if ((c == 't') && (strncmp(argv[1], "title", length) == 0)
&& (length >= 2)) {
@@ -1723,24 +1848,28 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (argc == 3) {
- interp->result = (wmPtr->title != NULL) ? wmPtr->title
- : winPtr->nameUid;
+ Tcl_SetResult(interp,
+ ((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid),
+ TCL_STATIC);
return TCL_OK;
} else {
if (wmPtr->title != NULL) {
- ckfree(wmPtr->title);
+ ckfree((char *) wmPtr->title);
}
wmPtr->title = ckalloc((unsigned) (strlen(argv[3]) + 1));
strcpy(wmPtr->title, argv[3]);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
+ Tcl_DString ds;
- if (XStringListToTextProperty(&wmPtr->title, 1,
+ Tcl_UtfToExternalDString(NULL, wmPtr->title, -1, &ds);
+ if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1,
&textProp) != 0) {
XSetWMName(winPtr->display, wmPtr->wrapperPtr->window,
&textProp);
XFree((char *) textProp.value);
}
+ Tcl_DStringFree(&ds);
}
}
} else if ((c == 't') && (strncmp(argv[1], "transient", length) == 0)
@@ -1755,7 +1884,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (argc == 3) {
if (wmPtr->master != None) {
- interp->result = wmPtr->masterWindowName;
+ Tcl_SetResult(interp, wmPtr->masterWindowName, TCL_STATIC);
}
return TCL_OK;
}
@@ -1783,6 +1912,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
CreateWrapper(wmPtr2);
}
wmPtr->master = Tk_WindowId(wmPtr2->wrapperPtr);
+ if (wmPtr->masterWindowName != NULL) {
+ ckfree((char *) wmPtr->masterWindowName);
+ }
wmPtr->masterWindowName = ckalloc((unsigned) (strlen(argv[3])+1));
strcpy(wmPtr->masterWindowName, argv[3]);
}
@@ -1810,8 +1942,9 @@ Tk_WmCmd(clientData, interp, argc, argv)
}
if (XWithdrawWindow(winPtr->display, wmPtr->wrapperPtr->window,
winPtr->screenNum) == 0) {
- interp->result =
- "couldn't send withdraw message to window manager";
+ Tcl_SetResult(interp,
+ "couldn't send withdraw message to window manager",
+ TCL_STATIC);
return TCL_ERROR;
}
WaitForMapNotify(winPtr, 0);
@@ -2029,6 +2162,8 @@ ConfigureEvent(wmPtr, configEventPtr)
{
TkWindow *wrapperPtr = wmPtr->wrapperPtr;
TkWindow *winPtr = wmPtr->winPtr;
+ TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
+ Tk_ErrorHandler handler;
/*
* Update size information from the event. There are a couple of
@@ -2046,7 +2181,7 @@ ConfigureEvent(wmPtr, configEventPtr)
if (((wrapperPtr->changes.width != configEventPtr->width)
|| (wrapperPtr->changes.height != configEventPtr->height))
&& !(wmPtr->flags & WM_SYNC_PENDING)){
- if (wmTracing) {
+ if (dispPtr->wmTracing) {
printf("TopLevelEventProc: user changed %s size to %dx%d\n",
winPtr->pathName, configEventPtr->width,
configEventPtr->height);
@@ -2110,7 +2245,7 @@ ConfigureEvent(wmPtr, configEventPtr)
wmPtr->configHeight = configEventPtr->height;
}
- if (wmTracing) {
+ if (dispPtr->wmTracing) {
printf("ConfigureEvent: %s x = %d y = %d, width = %d, height = %d",
winPtr->pathName, configEventPtr->x, configEventPtr->y,
configEventPtr->width, configEventPtr->height);
@@ -2156,12 +2291,15 @@ ConfigureEvent(wmPtr, configEventPtr)
/*
* Make sure that the toplevel and menubar are properly positioned within
- * the wrapper.
+ * the wrapper. If the menuHeight happens to be zero, we'll get a
+ * BadValue X error that we want to ignore [Bug: 3377]
*/
-
+ handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
+ (Tk_ErrorProc *) NULL, (ClientData) NULL);
XMoveResizeWindow(winPtr->display, winPtr->window, 0,
wmPtr->menuHeight, (unsigned) wrapperPtr->changes.width,
(unsigned) (wrapperPtr->changes.height - wmPtr->menuHeight));
+ Tk_DeleteErrorHandler(handler);
if ((wmPtr->menubar != NULL)
&& ((Tk_Width(wmPtr->menubar) != wrapperPtr->changes.width)
|| (Tk_Height(wmPtr->menubar) != wmPtr->menuHeight))) {
@@ -2213,6 +2351,7 @@ ReparentEvent(wmPtr, reparentEventPtr)
unsigned long numItems, bytesAfter;
unsigned int dummy;
Tk_ErrorHandler handler;
+ TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
/*
* Identify the root window for wrapperPtr. This is tricky because of
@@ -2238,7 +2377,7 @@ ReparentEvent(wmPtr, reparentEventPtr)
&& (actualType == XA_WINDOW))) {
if ((actualFormat == 32) && (numItems == 1)) {
vRoot = wmPtr->vRoot = *virtualRootPtr;
- } else if (wmTracing) {
+ } else if (dispPtr->wmTracing) {
printf("%s format %d numItems %ld\n",
"ReparentEvent got bogus VROOT property:", actualFormat,
numItems);
@@ -2247,7 +2386,7 @@ ReparentEvent(wmPtr, reparentEventPtr)
}
Tk_DeleteErrorHandler(handler);
- if (wmTracing) {
+ if (dispPtr->wmTracing) {
printf("ReparentEvent: %s reparented to 0x%x, vRoot = 0x%x\n",
wmPtr->winPtr->pathName,
(unsigned int) reparentEventPtr->parent, (unsigned int) vRoot);
@@ -2344,6 +2483,7 @@ ComputeReparentGeometry(wmPtr)
Window dummy2;
Status status;
Tk_ErrorHandler handler;
+ TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
handler = Tk_CreateErrorHandler(wrapperPtr->display, -1, -1, -1,
(Tk_ErrorProc *) NULL, (ClientData) NULL);
@@ -2410,7 +2550,7 @@ ComputeReparentGeometry(wmPtr)
wmPtr->wrapperPtr->changes.x = x + wmPtr->xInParent;
wmPtr->wrapperPtr->changes.y = y + wmPtr->yInParent;
- if (wmTracing) {
+ if (dispPtr->wmTracing) {
printf("wrapperPtr coords %d,%d, wmPtr coords %d,%d, offsets %d %d\n",
wrapperPtr->changes.x, wrapperPtr->changes.y,
wmPtr->x, wmPtr->y, wmPtr->xInParent, wmPtr->yInParent);
@@ -2443,6 +2583,7 @@ WrapperEventProc(clientData, eventPtr)
{
WmInfo *wmPtr = (WmInfo *) clientData;
XEvent mapEvent;
+ TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
wmPtr->flags |= WM_VROOT_OFFSET_STALE;
if (eventPtr->type == DestroyNotify) {
@@ -2462,7 +2603,7 @@ WrapperEventProc(clientData, eventPtr)
Tk_DestroyWindow((Tk_Window) wmPtr->winPtr);
Tk_DeleteErrorHandler(handler);
}
- if (wmTracing) {
+ if (dispPtr->wmTracing) {
printf("TopLevelEventProc: %s deleted\n", wmPtr->winPtr->pathName);
}
} else if (eventPtr->type == ConfigureNotify) {
@@ -2725,7 +2866,7 @@ UpdateGeometryInfo(clientData)
}
wmPtr->configWidth = width;
wmPtr->configHeight = height;
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("UpdateGeometryInfo moving to %d %d, resizing to %d x %d,\n",
x, y, width, height);
}
@@ -2746,7 +2887,7 @@ UpdateGeometryInfo(clientData)
}
wmPtr->configWidth = width;
wmPtr->configHeight = height;
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("UpdateGeometryInfo resizing to %d x %d\n", width, height);
}
XResizeWindow(winPtr->display, wmPtr->wrapperPtr->window,
@@ -2947,7 +3088,7 @@ WaitForConfigureNotify(winPtr, serial)
ConfigureNotify, &event);
wmPtr->flags &= ~WM_SYNC_PENDING;
if (code != TCL_OK) {
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("WaitForConfigureNotify giving up on %s\n",
winPtr->pathName);
}
@@ -2959,7 +3100,7 @@ WaitForConfigureNotify(winPtr, serial)
}
}
wmPtr->flags &= ~WM_MOVE_PENDING;
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("WaitForConfigureNotify finished with %s, serial %ld\n",
winPtr->pathName, serial);
}
@@ -3135,14 +3276,14 @@ WaitForMapNotify(winPtr, mapped)
* just quit.
*/
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("WaitForMapNotify giving up on %s\n", winPtr->pathName);
}
break;
}
}
wmPtr->flags &= ~WM_MOVE_PENDING;
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("WaitForMapNotify finished with %s\n", winPtr->pathName);
}
}
@@ -3188,7 +3329,7 @@ UpdateHints(winPtr)
*
* Results:
* A standard Tcl return value, plus an error message in
- * interp->result if an error occurs.
+ * the interp's result if an error occurs.
*
* Side effects:
* The size and/or location of winPtr may change.
@@ -3441,6 +3582,8 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
int x, y, childX, childY, tmpx, tmpy, bd;
WmInfo *wmPtr;
TkWindow *winPtr, *childPtr, *nextPtr;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ Tk_ErrorHandler handler = NULL;
/*
* Step 1: scan the list of toplevel windows to see if there is a
@@ -3452,7 +3595,7 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
parent = window = RootWindowOfScreen(Tk_Screen(tkwin));
x = rootX;
y = rootY;
- for (wmPtr = firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) {
+ for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) {
if (Tk_Screen(wmPtr->winPtr) != Tk_Screen(tkwin)) {
continue;
}
@@ -3479,15 +3622,24 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
* the toplevel.
*/
+ handler = Tk_CreateErrorHandler(Tk_Display(tkwin), -1, -1, -1,
+ (Tk_ErrorProc *) NULL, (ClientData) NULL);
while (1) {
if (XTranslateCoordinates(Tk_Display(tkwin), parent, window,
x, y, &childX, &childY, &child) == False) {
- panic("Tk_CoordsToWindow got False return from XTranslateCoordinates");
+ /*
+ * We can end up here when the window is in the middle of
+ * being deleted
+ */
+ Tk_DeleteErrorHandler(handler);
+ return NULL;
}
if (child == None) {
+ Tk_DeleteErrorHandler(handler);
return NULL;
}
- for (wmPtr = firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) {
+ for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
+ wmPtr = wmPtr->nextPtr) {
if (wmPtr->reparent == child) {
goto gotToplevel;
}
@@ -3506,6 +3658,14 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
}
gotToplevel:
+ if (handler) {
+ /*
+ * Check value of handler, because we can reach this label
+ * from above or below
+ */
+ Tk_DeleteErrorHandler(handler);
+ handler = NULL;
+ }
winPtr = wmPtr->winPtr;
if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) {
return NULL;
@@ -3644,7 +3804,7 @@ UpdateVRootGeometry(wmPtr)
(unsigned int *) &wmPtr->vRootWidth,
(unsigned int *) &wmPtr->vRootHeight, (unsigned int *) &bd,
&dummy);
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("UpdateVRootGeometry: x = %d, y = %d, width = %d, ",
wmPtr->vRootX, wmPtr->vRootY, wmPtr->vRootWidth);
printf("height = %d, status = %d\n", wmPtr->vRootHeight, status);
@@ -4818,3 +4978,63 @@ TkpGetWrapperWindow(winPtr)
return wmPtr->wrapperPtr;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UpdateCommand --
+ *
+ * Update the WM_COMMAND property, taking care to translate
+ * the command strings into the external encoding.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+UpdateCommand(winPtr)
+ TkWindow *winPtr;
+{
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+ Tcl_DString cmds, ds;
+ int i, *offsets;
+ char **cmdArgv;
+
+ /*
+ * Translate the argv strings into the external encoding. To avoid
+ * allocating lots of memory, the strings are appended to a buffer
+ * with nulls between each string.
+ *
+ * This code is tricky because we need to pass and array of pointers
+ * to XSetCommand. However, we can't compute the pointers as we go
+ * because the DString buffer space could get reallocated. So, store
+ * offsets for each element as we go, then compute pointers from the
+ * offsets once the entire DString is done.
+ */
+
+ cmdArgv = (char **) ckalloc(sizeof(char *) * wmPtr->cmdArgc);
+ offsets = (int *) ckalloc( sizeof(int) * wmPtr->cmdArgc);
+ Tcl_DStringInit(&cmds);
+ for (i = 0; i < wmPtr->cmdArgc; i++) {
+ Tcl_UtfToExternalDString(NULL, wmPtr->cmdArgv[i], -1, &ds);
+ offsets[i] = Tcl_DStringLength(&cmds);
+ Tcl_DStringAppend(&cmds, Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds)+1);
+ Tcl_DStringFree(&ds);
+ }
+ cmdArgv[0] = Tcl_DStringValue(&cmds);
+ for (i = 1; i < wmPtr->cmdArgc; i++) {
+ cmdArgv[i] = cmdArgv[0] + offsets[i];
+ }
+
+ XSetCommand(winPtr->display, wmPtr->wrapperPtr->window,
+ cmdArgv, wmPtr->cmdArgc);
+ Tcl_DStringFree(&cmds);
+ ckfree((char *) cmdArgv);
+ ckfree((char *) offsets);
+}
diff --git a/tk/unix/tkUnixXId.c b/tk/unix/tkUnixXId.c
index dfe8b1935f8..134e47dfaff 100644
--- a/tk/unix/tkUnixXId.c
+++ b/tk/unix/tkUnixXId.c
@@ -12,7 +12,7 @@
* George C. Kaplan and Michael Hoegeman.
*
* Copyright (c) 1993 The Regents of the University of California.
- * Copyright (c) 1994-1995 Sun Microsystems, Inc.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -28,9 +28,8 @@
#define XLIB_ILLEGAL_ACCESS 1
-#include "tkInt.h"
-#include "tkPort.h"
#include "tkUnixInt.h"
+#include "tkPort.h"
/*
* A structure of the following type is used to hold one or more
@@ -70,7 +69,7 @@ static void WindowIdCleanup2 _ANSI_ARGS_((ClientData clientData));
* None.
*
* Side effects:
- * The official allocator for the display is set up to be Tk_AllocXID.
+ * The official allocator for the display is set up to be AllocXId.
*
*----------------------------------------------------------------------
*/
@@ -535,3 +534,4 @@ TkpWindowWasRecentlyDeleted(win, dispPtr)
}
return 0;
}
+