Index: ChangeLog
===================================================================
RCS file: /cvsroot/tktoolkit/tk/ChangeLog,v
retrieving revision 1.758.2.254
diff -u -p -u -p -r1.758.2.254 ChangeLog
--- ChangeLog	13 May 2005 13:48:21 -0000	1.758.2.254
+++ ChangeLog	14 May 2005 19:16:13 -0000
@@ -1,3 +1,32 @@
+2005-05-14  Daniel Steffen  <das@users.sourceforge.net>
+
+	* macosx/tkMacOSXInit.c:
+	* macosx/tkMacOSXNotify.c: introduction of new tcl notifier based on
+	CFRunLoop allows replacement of the custom TkAqua notifier by a
+	standard tcl event source. Removes requirement of threaded tcl core
+	for TkAqua, allows to stub-link TkAqua against Tcl by removing use of
+	the unstubbed TclInitNotifier & TclFinalizeNotifier. [Tcl Patch 1202052]
+
+	* macosx/Wish.pbproj/project.pbxproj: stub-link TkAqua: build with
+	USE_TCL_STUBS and link against libtclstub instead of Tcl.framework,
+	unexport libtclstub symbols from Tk to avoid duplicate symbol warnings
+	when linking with both Tcl and Tk, fixes for gcc4.0 warnings.
+
+	* macosx/tkMacOSXBitmap.c:
+	* macosx/tkMacOSXButton.c:
+	* macosx/tkMacOSXDialog.c:
+	* macosx/tkMacOSXFont.c:
+	* macosx/tkMacOSXHLEvents.c:
+	* macosx/tkMacOSXInit.c:
+	* macosx/tkMacOSXKeyboard.c:
+	* macosx/tkMacOSXMenu.c:
+	* macosx/tkMacOSXMenubutton.c:
+	* macosx/tkMacOSXWm.c:
+	* macosx/tkMacOSXXStubs.c: fixed gcc 4.0 warnings.
+
+	* unix/tcl.m4: sync with tcl
+	* unix/configure: autoconf-2.13
+
 2005-05-10  Vince Darley <vincentdarley@users.sourceforge.net>
 
 	* library/text.tcl: test and fix to TextPrevPara to avoid infinite loop
Index: macosx/tkMacOSXBitmap.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXBitmap.c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 tkMacOSXBitmap.c
--- macosx/tkMacOSXBitmap.c	31 Aug 2002 06:12:29 -0000	1.2
+++ macosx/tkMacOSXBitmap.c	14 May 2005 19:16:13 -0000
@@ -240,7 +240,7 @@ TkpGetNativeAppBitmap(
     }
     
     if (resource == NULL) {
-        return NULL;
+        return (Pixmap) NULL;
     }
     
     pix = Tk_GetPixmap(display, None, 32, 32, 0);
Index: macosx/tkMacOSXButton.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXButton.c,v
retrieving revision 1.2.2.8
diff -u -p -u -p -r1.2.2.8 tkMacOSXButton.c
--- macosx/tkMacOSXButton.c	12 Mar 2005 00:49:28 -0000	1.2.2.8
+++ macosx/tkMacOSXButton.c	14 May 2005 19:16:13 -0000
@@ -965,7 +965,7 @@ TkMacOSXDrawControl(
         if (((mbPtr->info.image == NULL) && (mbPtr->info.bitmap == None))
                || (mbPtr->info.compound != COMPOUND_NONE)) {
             len = TkFontGetFirstTextLayout(butPtr->textLayout, 
-                    &font, controlTitle);
+                    &font, (char*) controlTitle);
             controlTitle[len] = 0;
         } else {
             len = 0;
@@ -974,7 +974,7 @@ TkMacOSXDrawControl(
         if (bcmp(mbPtr->controlTitle, controlTitle, len+1)) {
             CFStringRef cf;    	    
             cf = CFStringCreateWithCString(NULL,
-                  controlTitle, kCFStringEncodingUTF8);
+                  (char*) controlTitle, kCFStringEncodingUTF8);
             if (cf != NULL) {
             SetControlTitleWithCFString(mbPtr->control, cf);
             CFRelease(cf);
Index: macosx/tkMacOSXDialog.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXDialog.c,v
retrieving revision 1.4.2.3
diff -u -p -u -p -r1.4.2.3 tkMacOSXDialog.c
--- macosx/tkMacOSXDialog.c	22 Feb 2005 08:49:14 -0000	1.4.2.3
+++ macosx/tkMacOSXDialog.c	14 May 2005 19:16:13 -0000
@@ -214,7 +214,7 @@ Tk_ChooseColorObjCmd(
     cpinfo.pickerType = 0L;
     cpinfo.eventProc = NULL;
     cpinfo.colorProc = NULL;
-    cpinfo.colorProcData = NULL;
+    cpinfo.colorProcData = 0;
     
     /* This doesn't seem to actually set the title! */
     Tcl_UtfToExternal(NULL, NULL, title, -1, 0, NULL, 
@@ -338,7 +338,7 @@ Tk_GetOpenFileObjCmd(
                 break;
             case OPEN_MESSAGE:
                 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
-                message = CFStringCreateWithBytes(NULL, choice, choiceLen, 
+                message = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen, 
                         kCFStringEncodingUTF8, false);
                 break;
             case OPEN_MULTIPLE:
@@ -358,7 +358,7 @@ Tk_GetOpenFileObjCmd(
                 break;
             case OPEN_TITLE:
                 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
-                title = CFStringCreateWithBytes(NULL, choice, choiceLen, 
+                title = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen, 
                         kCFStringEncodingUTF8, false);
                 break;
         }
@@ -474,7 +474,7 @@ Tk_GetSaveFileObjCmd(
                 break;
             case SAVE_MESSAGE:
                 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
-                message = CFStringCreateWithBytes(NULL, choice, choiceLen, 
+                message = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen, 
                         kCFStringEncodingUTF8, false);
                 break;
             case SAVE_PARENT:
@@ -487,7 +487,7 @@ Tk_GetSaveFileObjCmd(
                 break;
             case SAVE_TITLE:
                 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
-                title = CFStringCreateWithBytes(NULL, choice, choiceLen, 
+                title = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen, 
                         kCFStringEncodingUTF8, false);
                 break;
         }
@@ -595,7 +595,7 @@ Tk_ChooseDirectoryObjCmd(clientData, int
                 break;
             case CHOOSE_MESSAGE:
                 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
-                message = CFStringCreateWithBytes(NULL, choice, choiceLen, 
+                message = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen, 
                         kCFStringEncodingUTF8, false);
                 break;
             case CHOOSE_PARENT:
@@ -608,7 +608,7 @@ Tk_ChooseDirectoryObjCmd(clientData, int
                 break;
             case CHOOSE_TITLE:
                 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
-                title = CFStringCreateWithBytes(NULL, choice, choiceLen, 
+                title = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen, 
                         kCFStringEncodingUTF8, false);
                 break;
         }
@@ -657,7 +657,7 @@ HandleInitialDirectory (
             return TCL_ERROR;
         }
 
-        err = FSPathMakeRef(dirName,
+        err = FSPathMakeRef((unsigned char*) dirName,
                 dirRef, &isDirectory);     
 
         if (err != noErr) {
@@ -691,7 +691,7 @@ HandleInitialDirectory (
 
         AECreateList(NULL, 0, false, selectDescPtr);
 
-        err = FSPathMakeRef(namePtr, &fileRef, &isDirectory);
+        err = FSPathMakeRef((unsigned char*) namePtr, &fileRef, &isDirectory);
         if (err != noErr) {
             Tcl_AppendResult(interp, "bad initialfile \"", initialFile,
                     "\" file does not exist.", NULL);
@@ -883,7 +883,7 @@ NavServicesGetFile(
                             != noErr ) {
                         fprintf(stderr,"AEGetDescData failed %d\n", err );
                     } else {
-                        if (err = FSRefMakePath(&fsRef, pathPtr, 1024) ) {
+                        if (err = FSRefMakePath(&fsRef, (unsigned char*) pathPtr, 1024) ) {
                             fprintf(stderr,"FSRefMakePath failed, %d\n", err );
                         } else {
                             if (isOpen == SAVE_FILE) {
@@ -1001,9 +1001,9 @@ OpenFileFilterProc( 
                         int len;
                         fileNamePtr = (((FSSpec *) *theItem->dataHandle)->name);
                         len = fileNamePtr[0];
-                        strncpy(fileName, fileNamePtr + 1, len);
+                        strncpy(fileName, (char*) fileNamePtr + 1, len);
                         fileName[len] = '\0';
-                        fileNamePtr = fileName;
+                        fileNamePtr = (unsigned char*) fileName;
 
                     } else if (theItem->descriptorType = typeFSRef) {
                         OSStatus err;
@@ -1017,7 +1017,7 @@ OpenFileFilterProc( 
                                     (Tcl_UniChar *) uniFileName.unicode, 
                                     uniFileName.length,
                                     &fileNameDString);
-                            fileNamePtr = Tcl_DStringValue(&fileNameDString);
+                            fileNamePtr = (unsigned char*) Tcl_DStringValue(&fileNameDString);
                         } else {
                             fileNamePtr = NULL;
                         }
@@ -1162,7 +1162,7 @@ MatchOneType(
                  * have "." in it
                  */
 
-                for (q = fileNamePtr; *q; q++) {
+                for (q = (char*) fileNamePtr; *q; q++) {
                     if (*q == '.') {
                         goto glob_unmatched;
                     }
@@ -1170,7 +1170,7 @@ MatchOneType(
                 goto glob_matched;
             }
         
-            if (Tcl_StringMatch(fileNamePtr, ext)) {
+            if (Tcl_StringMatch((char*) fileNamePtr, ext)) {
                 goto glob_matched;
             } else {
                 goto glob_unmatched;
Index: macosx/tkMacOSXFont.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXFont.c,v
retrieving revision 1.3.2.2
diff -u -p -u -p -r1.3.2.2 tkMacOSXFont.c
--- macosx/tkMacOSXFont.c	12 Nov 2004 09:03:40 -0000	1.3.2.2
+++ macosx/tkMacOSXFont.c	14 May 2005 19:16:13 -0000
@@ -87,7 +87,7 @@ static TkStateMap scriptMap[] = {
     {smEastEurRoman,    "macCentEuro"},
     {smVietnamese,      "macVietnam"},
     {smExtArabic,       "macSindhi"},
-    {NULL,               NULL}
+    {0,                 NULL}
 };    
 
 static TkStateMap romanMap[] = {
@@ -97,13 +97,13 @@ static TkStateMap romanMap[] = {
     {langRomanian,        "macRomania"},
     {langTurkish,         "macTurkish"},
     {langGreek,           "macGreek"},
-    {NULL,                NULL}
+    {0,                   NULL}
 };
 
 static TkStateMap cyrillicMap[] = {
     {langUkrainian,        "macUkraine"},
     {langBulgarian,        "macBulgaria"},
-    {NULL,                NULL}
+    {0,                    NULL}
 };
 
 /*
Index: macosx/tkMacOSXHLEvents.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXHLEvents.c,v
retrieving revision 1.5.2.4
diff -u -p -u -p -r1.5.2.4 tkMacOSXHLEvents.c
--- macosx/tkMacOSXHLEvents.c	17 Mar 2004 19:35:41 -0000	1.5.2.4
+++ macosx/tkMacOSXHLEvents.c	14 May 2005 19:16:13 -0000
@@ -544,7 +544,7 @@ FSRefToDString(const FSRef *fsref, Tcl_D
 
     err = FSRefMakePath(fsref, fileName, sizeof(fileName));
     if (err == noErr) {
-        Tcl_ExternalToUtfDString(NULL, fileName, -1, ds);
+        Tcl_ExternalToUtfDString(NULL, (char*) fileName, -1, ds);
     }
     return err;
 }
Index: macosx/tkMacOSXInit.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXInit.c,v
retrieving revision 1.3.2.4
diff -u -p -u -p -r1.3.2.4 tkMacOSXInit.c
--- macosx/tkMacOSXInit.c	25 Jan 2005 06:54:58 -0000	1.3.2.4
+++ macosx/tkMacOSXInit.c	14 May 2005 19:16:13 -0000
@@ -79,7 +79,7 @@ static Map scriptMap[] = {
     {smEastEurRoman,	"macCentEuro"},
     {smVietnamese,	"macVietnam"},
     {smExtArabic,	"macSindhi"},
-    {NULL,		NULL}
+    {0, 		NULL}
 };
 
 Tcl_Encoding TkMacOSXCarbonEncoding = NULL;
@@ -115,6 +115,8 @@ TkpInit(interp)
     static char tkLibPath[PATH_MAX + 1];
     static int tkMacOSXInitialized = false;
 
+    Tk_MacOSXSetupTkNotifier();
+
     /* 
      * Since it is possible for TkInit to be called multiple times
      * and we don't want to do the initialization multiple times
@@ -128,7 +130,6 @@ TkpInit(interp)
 
     	tkMacOSXInitialized = true;
 
-        Tk_MacOSXSetupTkNotifier();
         TkMacOSXInitAppleEvents(interp);
         TkMacOSXInitMenus(interp);
         TkMacOSXUseAntialiasedText(interp, TRUE);
@@ -370,13 +371,13 @@ TkMacOSXDefaultStartupScript(void)
             char startupScript[PATH_MAX + 1];
                             
             if (CFURLGetFileSystemRepresentation (appMainURL, true,
-                    startupScript, PATH_MAX)) {
+                    (unsigned char*) startupScript, PATH_MAX)) {
                 TclSetStartupScriptFileName(startupScript);
                 scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(
                         NULL, appMainURL);
                 if (scriptFldrURL != NULL) {
                     CFURLGetFileSystemRepresentation(scriptFldrURL, 
-                            true, scriptPath, PATH_MAX);
+                            true, (unsigned char*) scriptPath, PATH_MAX);
                     CFRelease(scriptFldrURL);
                 }
             }
Index: macosx/tkMacOSXKeyboard.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXKeyboard.c,v
retrieving revision 1.5.2.3
diff -u -p -u -p -r1.5.2.3 tkMacOSXKeyboard.c
--- macosx/tkMacOSXKeyboard.c	25 Feb 2004 13:29:41 -0000	1.5.2.3
+++ macosx/tkMacOSXKeyboard.c	14 May 2005 19:16:13 -0000
@@ -30,6 +30,7 @@
 #define LATIN1_MAX       255
 #define MAC_KEYCODE_MAX  0x7F
 #define MAC_KEYCODE_MASK 0x7F
+#undef ALT_MASK
 #define ALT_MASK         Mod1Mask
 #define OPTION_MASK      Mod2Mask
 
Index: macosx/tkMacOSXMenu.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXMenu.c,v
retrieving revision 1.6.2.6
diff -u -p -u -p -r1.6.2.6 tkMacOSXMenu.c
--- macosx/tkMacOSXMenu.c	20 Jul 2004 06:05:59 -0000	1.6.2.6
+++ macosx/tkMacOSXMenu.c	14 May 2005 19:16:13 -0000
@@ -946,9 +946,11 @@ TkpConfigureMenuEntry(
 			 * some fields. */
 {
     TkMenu *menuPtr = mePtr->menuPtr;
+#if 0 /* Unused */ 
     int index = mePtr->index;
     MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
     MenuHandle helpMenuHdl = NULL;
+#endif
 
     /*
      * Cascade menus have to have menu IDs of less than 256. So
@@ -1081,7 +1083,6 @@ ReconfigureIndividualMenu(
                     0, NULL);
     	} else {
     	    Tcl_DString itemTextDString;
-    	    int destWrote;
             CFStringRef cf;    	    
 	    GetEntryText(mePtr, &itemTextDString);
             cf = CFStringCreateWithCString(NULL,
@@ -1754,7 +1755,6 @@ DrawMenuBarWhenIdle(
 	    	} else if (i == helpIndex) {
 	    	    TkMenu *helpMenuPtr = menuBarPtr->entries[i]
 	    	    	    ->childMenuRefPtr->menuPtr;
-	    	    MenuHandle helpMenuHdl = NULL;
 	    	    
 	    	    if (helpMenuPtr == NULL) {
 	    	    	continue;
@@ -4307,9 +4307,11 @@ HandleMenuFindItemsMsg (MenuRef menu, 
         TkMenu *menuPtr)
 {
     TkMenuEntry *parentEntryPtr;
+#if 0 /* Unused */ 
     Tk_Font tkfont;
     Tk_FontMetrics fontMetrics, entryMetrics;
     Tk_FontMetrics *fmPtr;
+#endif
     TkMenuEntry *mePtr;
     int i;
     int newItem = -1;
@@ -4475,8 +4477,10 @@ HandleMenuFindItemsMsg (MenuRef menu, 
     }
     
     if (scrollDirection != DONT_SCROLL) {
+#if 0
         Tk_Font menuFont;
         RgnHandle updateRgn = NewRgn();
+#endif
         
         ScrollMenuImage(menu, menuRectPtr, 0, scrollAmt, NULL);
         mtdPtr->virtualMenuTop += scrollAmt;
Index: macosx/tkMacOSXMenubutton.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXMenubutton.c,v
retrieving revision 1.2.2.1
diff -u -p -u -p -r1.2.2.1 tkMacOSXMenubutton.c
--- macosx/tkMacOSXMenubutton.c	16 Feb 2004 00:42:34 -0000	1.2.2.1
+++ macosx/tkMacOSXMenubutton.c	14 May 2005 19:16:13 -0000
@@ -234,7 +234,7 @@ TkpDisplayMenuButton(
         if (titleChanged) {
             CFStringRef cf;    	    
             cf = CFStringCreateWithCString(NULL,
-                  titleParams.title, kCFStringEncodingUTF8);
+                  (char*) titleParams.title, kCFStringEncodingUTF8);
             if (hasImageOrBitmap) {
                 SetControlTitleWithCFString(mbPtr->control, cf);
             } else {
@@ -559,7 +559,7 @@ static void
 ComputeControlTitleParams(TkMenuButton * butPtr, ControlTitleParams * paramsPtr )
 {
     Tk_Font font;
-    paramsPtr->len =TkFontGetFirstTextLayout(butPtr->textLayout,&font, paramsPtr->title);
+    paramsPtr->len =TkFontGetFirstTextLayout(butPtr->textLayout,&font, (char*) paramsPtr->title);
     paramsPtr->title [paramsPtr->len] = 0;
     if (paramsPtr->len) {
         TkMacOSXInitControlFontStyle(font,&paramsPtr->style);
@@ -663,7 +663,7 @@ MenuButtonInitControl (
     if (mbPtr->params.isBevel) {
             CFStringRef cf;    	    
             cf = CFStringCreateWithCString(NULL,
-                  mbPtr->titleParams.title, kCFStringEncodingUTF8);
+                  (char*) mbPtr->titleParams.title, kCFStringEncodingUTF8);
         SetControlTitleWithCFString(mbPtr->control, cf);
         CFRelease(cf);
         if (mbPtr->titleParams.len) {
@@ -687,7 +687,7 @@ MenuButtonInitControl (
             return 1;
         }
         cf = CFStringCreateWithCString(NULL,
-                mbPtr->titleParams.title, kCFStringEncodingUTF8);
+                (char*) mbPtr->titleParams.title, kCFStringEncodingUTF8);
         AppendMenuItemText(mbPtr->menuRef, "\px");
         if (cf != NULL) {
         SetMenuItemTextWithCFString(mbPtr->menuRef, 1, cf);
Index: macosx/tkMacOSXNotify.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXNotify.c,v
retrieving revision 1.5.2.3
diff -u -p -u -p -r1.5.2.3 tkMacOSXNotify.c
--- macosx/tkMacOSXNotify.c	26 Apr 2005 00:49:50 -0000	1.5.2.3
+++ macosx/tkMacOSXNotify.c	14 May 2005 19:16:13 -0000
@@ -1,13 +1,12 @@
 /*
  * tkMacOSXNotify.c --
  *
- *	This file contains the implementation of a merged 
- *	Carbon/select-based notifier, which is the lowest-level part 
- *	of the Tcl event loop.  This file works together with
- *	../generic/tclNotify.c.
+ *	This file contains the implementation of a tcl event source 
+ *	for the Carbon event loop.
  *
  * Copyright (c) 1995-1997 Sun Microsystems, Inc.
  * Copyright 2001, Apple Computer, Inc.
+ * Copyright 2005, Tcl Core Team.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -18,199 +17,35 @@
 #include "tclInt.h"
 #include "tkInt.h"
 #include "tkMacOSXEvent.h"
-
-#include <signal.h> 
-
-#ifndef TCL_THREADS
-#error Mac OS X notifier requires tcl threads!
-#endif
-
-/*
- * This structure is used to keep track of the notifier info for a 
- * a registered file.
- */
-
-typedef struct FileHandler {
-    int fd;
-    int mask;			/* Mask of desired events: TCL_READABLE,
-				 * etc. */
-    int readyMask;		/* Mask of events that have been seen since the
-				 * last time file handlers were invoked for
-				 * this file. */
-    Tcl_FileProc *proc;		/* Procedure to call, in the style of
-				 * Tcl_CreateFileHandler. */
-    ClientData clientData;	/* Argument to pass to proc. */
-    struct FileHandler *nextPtr;/* Next in list of all files we care about. */
-} FileHandler;
-
-/*
- * The following structure is what is added to the Tcl event queue when
- * file handlers are ready to fire.
- */
-
-typedef struct FileHandlerEvent {
-    Tcl_Event header;		/* Information that is standard for
-				 * all events. */
-    int fd;			/* File descriptor that is ready.  Used
-				 * to find the FileHandler structure for
-				 * the file (can't point directly to the
-				 * FileHandler structure because it could
-				 * go away while the event is queued). */
-} FileHandlerEvent;
+#include <pthread.h>
 
 /*
- *
- * The following structure contains a set of select() masks to track
- * readable, writable, and exceptional conditions.
- */
-
-typedef struct SelectMasks {
-    fd_set readable;
-    fd_set writable;
-    fd_set exceptional;
-} SelectMasks;
-
-/*
- * The following static structure contains the state information for the
- * select based implementation of the Tcl notifier.  One of these structures
- * is created for each thread that is using the notifier.  
+ * The following static indicates whether this module has been initialized
+ * in the current thread.
  */
 
 typedef struct ThreadSpecificData {
-    FileHandler *firstFileHandlerPtr;
-				/* Pointer to head of file handler list. */
-    
-    SelectMasks checkMasks;	/* This structure is used to build up the masks
-				 * to be used in the next call to select.
-				 * Bits are set in response to calls to
-				 * Tcl_CreateFileHandler. */
-    SelectMasks readyMasks;	/* This array reflects the readable/writable
-				 * conditions that were found to exist by the
-				 * last call to select. */
-    int numFdBits;		/* Number of valid bits in checkMasks
-				 * (one more than highest fd for which
-				 * Tcl_WatchFile has been called). */
-    int isMainLoop;             /* Is this the main Carbon Loop (in which case
-                                 * we will call RNE in the actual wait... */
-    int onList;			/* True if it is in this list */
-    unsigned int pollState;	/* pollState is used to implement a polling 
-				 * handshake between each thread and the
-				 * notifier thread. Bits defined below. */
-    struct ThreadSpecificData *nextPtr, *prevPtr;
-                                /* All threads that are currently waiting on 
-                                 * an event have their ThreadSpecificData
-                                 * structure on a doubly-linked listed formed
-                                 * from these pointers.  You must hold the
-                                 * notifierMutex lock before accessing these
-                                 * fields. */
-    Tcl_Condition waitCV;     /* Any other thread alerts a notifier
-				 * that an event is ready to be processed
-				 * by signaling this condition variable. */
-    int eventReady;           /* True if an event is ready to be processed.
-                               * Used as condition flag together with
-                               * waitCV above. */
+    int initialized;
 } ThreadSpecificData;
-
 static Tcl_ThreadDataKey dataKey;
 
-/*
- * The following static indicates the number of threads that have
- * initialized notifiers.
- *
- * You must hold the notifierMutex lock before accessing this variable.
- */
-
-static int notifierCount = 0;
-
-/*
- * The following variable points to the head of a doubly-linked list of 
- * of ThreadSpecificData structures for all threads that are currently
- * waiting on an event.
- *
- * You must hold the notifierMutex lock before accessing this list.
- */
-
-static ThreadSpecificData *waitingListPtr = NULL;
-
-/*
- * The notifier thread spends all its time in select() waiting for a
- * file descriptor associated with one of the threads on the waitingListPtr
- * list to do something interesting.  But if the contents of the
- * waitingListPtr list ever changes, we need to wake up and restart
- * the select() system call.  You can wake up the notifier thread by
- * writing a single byte to the file descriptor defined below.  This
- * file descriptor is the input-end of a pipe and the notifier thread is
- * listening for data on the output-end of the same pipe.  Hence writing
- * to this file descriptor will cause the select() system call to return
- * and wake up the notifier thread.
- *
- * You must hold the notifierMutex lock before accessing this list.
- */
-
-static int triggerPipe = -1;
-
-/*
- * The notifierMutex locks access to all of the global notifier state. 
- */
-
-TCL_DECLARE_MUTEX(notifierMutex)
-
-/*
- * The notifier thread signals the notifierCV when it has finished
- * initializing the triggerPipe and right before the notifier
- * thread terminates.
- */
-
-static Tcl_Condition notifierCV;
+static void TkMacOSXNotifyExitHandler(ClientData clientData);
+static void CarbonEventsSetupProc(ClientData clientData, int flags);
+static void CarbonEventsCheckProc(ClientData clientData, int flags);
 
-/*
- * The pollState bits
- *	POLL_WANT is set by each thread before it waits on its condition
- *		variable.  It is checked by the notifier before it does
- *		select.
- *	POLL_DONE is set by the notifier if it goes into select after
- *		seeing POLL_WANT.  The idea is to ensure it tries a select
- *		with the same bits the initial thread had set.
- */
-#define POLL_WANT	0x1
-#define POLL_DONE	0x2
-
-/*
- * This is the thread ID of the notifier thread that does select.
- */
-static Tcl_ThreadId notifierThread;
-
-/*
- * Static routines defined in this file.
- */
-
-static void	NotifierThreadProc _ANSI_ARGS_((ClientData clientData));
-static int	FileHandlerEventProc _ANSI_ARGS_((Tcl_Event *evPtr,
-		    int flags));
-                    
-void TkMacOSXSetTimer(Tcl_Time *timePtr);
-void TkMacOSXCreateFileHandler(int fd, int mask, Tcl_FileProc *proc, ClientData clientData);
-void TkMacOSXDeleteFileHandler(int fd);
-int  TkMacOSXWaitForEvent(Tcl_Time *timePtr);
-void TkMacOSXAlertNotifier(ClientData clientData);
-ClientData TkMacOSXInitNotifier();
-void TkMacOSXFinalizeNotifier(ClientData clientData);
-void TkMacOSXServiceModeHook(int mode);
-EventRef TkMacOSXCreateFakeEvent ();
 /*
  *----------------------------------------------------------------------
  *
  * Tk_MacOSXSetupTkNotifier --
  *
- *	Replaces the Tcl notifier (from tclUnixNotfy.c) with
- *      the Mac notifier that melds the Unix select based notifer
- *      with the Carbon event handling side of the Tk notifier.
+ *	This procedure is called during Tk initialization to create
+ *	the event source for Carbon events.
  *
  * Results:
- *	Replaces the notifier callbacks with MacOS X specific ones.
+ *	None.
  *
  * Side effects:
- *	None.
+ *	A new event source is created.
  *
  *----------------------------------------------------------------------
  */
@@ -218,242 +53,45 @@ EventRef TkMacOSXCreateFakeEvent ();
 void
 Tk_MacOSXSetupTkNotifier()
 {
-    EventQueueRef mainEventQueue;
-    Tcl_NotifierProcs macNotifierProcs = {
-        TkMacOSXSetTimer,
-        TkMacOSXWaitForEvent,
-        TkMacOSXCreateFileHandler,
-        TkMacOSXDeleteFileHandler,
-        TkMacOSXInitNotifier,
-        TkMacOSXFinalizeNotifier,
-        TkMacOSXAlertNotifier,
-        TkMacOSXServiceModeHook
-    };
-
-    /*
-     * Dispose of existing unix notifier thread
-     */
-
-    TclFinalizeNotifier();
-    
-    Tcl_SetNotifier(&macNotifierProcs);
-
-    /* HACK ALERT: There is a bug in Jaguar where when it goes to make
-     * the event queue for the Main Event Loop, it stores the Current
-     * event loop rather than the Main Event Loop in the Queue structure.
-     * So we have to make sure that the Main Event Queue gets set up on
-     * the main thread.  Calling GetMainEventQueue will force this to
-     * happen.
-     */
-    
-    mainEventQueue = GetMainEventQueue();
-    
-    /* 
-     * Tcl_SetNotifier doesn't call the TclInitNotifier
-     * so we call it now. If we don't do this the
-     * ThreadSpecificData will keep a pointer to the original
-     * InitNotifier. See tclNotify.c:TclInitNotifier().
-     */
-
-    TclInitNotifier(); 
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_InitNotifier --
- *
- *	Initializes the platform specific notifier state.
- *
- * Results:
- *	Returns a handle to the notifier state for this thread..
- *
- * Side effects:
- *	None.
- *
- *----------------------------------------------------------------------
- */
-
-ClientData
-TkMacOSXInitNotifier()
-{
     ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-
-    tsdPtr->eventReady = 0;
-
-    /*
-     * Start the Notifier thread if necessary.
-     */
-
-    Tcl_MutexLock(&notifierMutex);
-    if (notifierCount == 0) {
-	if (Tcl_CreateThread(&notifierThread, NotifierThreadProc, NULL,
-		     TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS) != TCL_OK) {
-	    panic("Tcl_InitNotifier: unable to start notifier thread");
-	}
-    }
-    notifierCount++;
     
-    if (GetCurrentEventLoop() == GetMainEventLoop()) {
-        tsdPtr->isMainLoop = 1;
-    } else {
-        tsdPtr->isMainLoop = 0;
-    }
-
-    /*
-     * Wait for the notifier pipe to be created.
-     */
-
-    while (triggerPipe < 0) {
-	Tcl_ConditionWait(&notifierCV, &notifierMutex, NULL);
-    }
-
-    Tcl_MutexUnlock(&notifierMutex);
-    return (ClientData) tsdPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_FinalizeNotifier --
- *
- *	This function is called to cleanup the notifier state before
- *	a thread is terminated.
- *
- * Results:
- *	None.
- *
- * Side effects:
- *	May terminate the background notifier thread if this is the
- *	last notifier instance.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXFinalizeNotifier(clientData)
-    ClientData clientData;		/* Not used. */
-{
-    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-
-    Tcl_MutexLock(&notifierMutex);
-    notifierCount--;
-
-    /*
-     * If this is the last thread to use the notifier, close the notifier
-     * pipe and wait for the background thread to terminate.
-     */
+    if (!tsdPtr->initialized) {
+        /* HACK ALERT: There is a bug in Jaguar where when it goes to make
+         * the event queue for the Main Event Loop, it stores the Current
+         * event loop rather than the Main Event Loop in the Queue structure.
+         * So we have to make sure that the Main Event Queue gets set up on
+         * the main thread.  Calling GetMainEventQueue will force this to
+         * happen.
+         */
+        EventQueueRef mainEventQueue = GetMainEventQueue();
 
-    if (notifierCount == 0) {
-	if (triggerPipe < 0) {
-	    panic("Tcl_FinalizeNotifier: notifier pipe not initialized");
+        tsdPtr->initialized = 1;
+        /* Install Carbon events event source in main event loop thread. */
+        if (GetCurrentEventLoop() == GetMainEventLoop()) {
+            if (!pthread_main_np()) {
+                /* 
+                 * Panic if the Carbon main event loop thread (i.e. the 
+                 * thread  where HIToolbox was first loaded) is not the
+                 * main application thread, as Carbon does not support
+                 * this properly.
+                 */
+                Tcl_Panic("Tk_MacOSXSetupTkNotifier: %s",
+                    "first [load] of TkAqua has to occur in the main thread!");
+            }
+            Tcl_CreateEventSource(CarbonEventsSetupProc, 
+                    CarbonEventsCheckProc, GetMainEventQueue());
+            TkCreateExitHandler(TkMacOSXNotifyExitHandler, NULL);
 	}
-
-        /*
-	 * Send "q" message to the notifier thread so that it will
-	 * terminate.  The notifier will return from its call to select()
-	 * and notice that a "q" message has arrived, it will then close
-	 * its side of the pipe and terminate its thread.  Note the we can
-	 * not just close the pipe and check for EOF in the notifier
-	 * thread because if a background child process was created with
-	 * exec, select() would not register the EOF on the pipe until the
-	 * child processes had terminated. [Bug: 4139]
-	 */
-	write(triggerPipe, "q", 1);
-	close(triggerPipe);
-
-	Tcl_ConditionWait(&notifierCV, &notifierMutex, NULL);
     }
-
-    /*
-     * Clean up any synchronization objects in the thread local storage.
-     */
-
-    Tcl_ConditionFinalize(&(tsdPtr->waitCV));
-
-    Tcl_MutexUnlock(&notifierMutex);
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_AlertNotifier --
- *
- *	Wake up the specified notifier from any thread. This routine
- *	is called by the platform independent notifier code whenever
- *	the Tcl_ThreadAlert routine is called.  This routine is
- *	guaranteed not to be called on a given notifier after
- *	Tcl_FinalizeNotifier is called for that notifier.
- *
- * Results:
- *	None.
- *
- * Side effects:
- *	Signals the notifier condition variable for the specified
- *	notifier.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXAlertNotifier(clientData)
-    ClientData clientData;
-{
-    ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
-    Tcl_MutexLock(&notifierMutex);
-    tsdPtr->eventReady = 1;
-    if (tsdPtr->isMainLoop) {
-       OSErr err;
-       
-       /* We need to wake up the main loop, and let it have the event. */
-       EventRef fakeEvent = TkMacOSXCreateFakeEvent();
-       EventQueueRef mainEventQueue = GetMainEventQueue();
-       
-       err = PostEventToQueue(mainEventQueue, fakeEvent,
-                              kEventPriorityHigh);
-       ReleaseEvent(fakeEvent);
-    } else {
-       Tcl_ConditionNotify(&tsdPtr->waitCV);
-    }
-    Tcl_MutexUnlock(&notifierMutex);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_SetTimer --
- *
- *	This procedure sets the current notifier timer value.  This
- *	interface is not implemented in this notifier because we are
- *	always running inside of Tcl_DoOneEvent.
- *
- * Results:
- *	None.
- *
- * Side effects:
- *	None.
- *
- *----------------------------------------------------------------------
- */
 
-void
-TkMacOSXSetTimer(timePtr)
-    Tcl_Time *timePtr;		/* Timeout value, may be NULL. */
-{
-    /*
-     * The interval timer doesn't do anything in this implementation,
-     * because the only event loop is via Tcl_DoOneEvent, which passes
-     * timeout values to Tcl_WaitForEvent.
-     */
-
-}
-
 /*
  *----------------------------------------------------------------------
  *
- * Tcl_ServiceModeHook --
+ * TkMacOSXNotifyExitHandler --
  *
- *	This function is invoked whenever the service mode changes.
+ *	This function is called during finalization to clean up the
+ *	TkMacOSXNotify module.
  *
  * Results:
  *	None.
@@ -464,652 +102,79 @@ TkMacOSXSetTimer(timePtr)
  *----------------------------------------------------------------------
  */
 
-void
-TkMacOSXServiceModeHook(mode)
-    int mode;			/* Either TCL_SERVICE_ALL, or
-				 * TCL_SERVICE_NONE. */
-{
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_CreateFileHandler --
- *
- *	This procedure registers a file handler with the select notifier.
- *
- * Results:
- *	None.
- *
- * Side effects:
- *	Creates a new file handler structure.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXCreateFileHandler(fd, mask, proc, clientData)
-    int fd;			/* Handle of stream to watch. */
-    int mask;			/* OR'ed combination of TCL_READABLE,
-				 * TCL_WRITABLE, and TCL_EXCEPTION:
-				 * indicates conditions under which
-				 * proc should be called. */
-    Tcl_FileProc *proc;		/* Procedure to call for each
-				 * selected event. */
-    ClientData clientData;	/* Arbitrary data to pass to proc. */
+static void
+TkMacOSXNotifyExitHandler(clientData)
+    ClientData clientData;	/* Not used. */
 {
     ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-    FileHandler *filePtr;
-
-    for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
-	 filePtr = filePtr->nextPtr) {
-	if (filePtr->fd == fd) {
-	    break;
-	}
-    }
-    if (filePtr == NULL) {
-	filePtr = (FileHandler*) ckalloc(sizeof(FileHandler));
-	filePtr->fd = fd;
-	filePtr->readyMask = 0;
-	filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
-	tsdPtr->firstFileHandlerPtr = filePtr;
-    }
-    filePtr->proc = proc;
-    filePtr->clientData = clientData;
-    filePtr->mask = mask;
 
-    /*
-     * Update the check masks for this file.
-     */
-
-    if ( mask & TCL_READABLE ) {
-	FD_SET( fd, &(tsdPtr->checkMasks.readable) );
-    } else {
-	FD_CLR( fd, &(tsdPtr->checkMasks.readable) );
-    }
-    if ( mask & TCL_WRITABLE ) {
-	FD_SET( fd, &(tsdPtr->checkMasks.writable) );
-    } else {
-	FD_CLR( fd, &(tsdPtr->checkMasks.writable) );
-    }
-    if ( mask & TCL_EXCEPTION ) {
-	FD_SET( fd, &(tsdPtr->checkMasks.exceptional) );
-    } else {
-	FD_CLR( fd, &(tsdPtr->checkMasks.exceptional) );
-    }
-    if (tsdPtr->numFdBits <= fd) {
-	tsdPtr->numFdBits = fd+1;
-    }
+    Tcl_DeleteEventSource(CarbonEventsSetupProc, 
+            CarbonEventsCheckProc, GetMainEventQueue());
+    tsdPtr->initialized = 0;
 }
 
 /*
  *----------------------------------------------------------------------
  *
- * Tcl_DeleteFileHandler --
+ * CarbonEventsSetupProc --
  *
- *	Cancel a previously-arranged callback arrangement for
- *	a file.
+ *	This procedure implements the setup part of the Carbon Events
+ *	event source.  It is invoked by Tcl_DoOneEvent before entering
+ *	the notifier to check for events.
  *
  * Results:
  *	None.
  *
  * Side effects:
- *	If a callback was previously registered on file, remove it.
+ *	If Carbon events are queued, then the maximum block time will be
+ *	set to 0 to ensure that the notifier returns control to Tcl.
  *
  *----------------------------------------------------------------------
  */
 
-void
-TkMacOSXDeleteFileHandler(fd)
-    int fd;		/* Stream id for which to remove callback procedure. */
+static void
+CarbonEventsSetupProc(clientData, flags)
+    ClientData clientData;
+    int flags;
 {
-    FileHandler *filePtr, *prevPtr;
-    int i;
-    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-
-    /*
-     * Find the entry for the given file (and return if there isn't one).
-     */
+    static Tcl_Time blockTime = { 0, 0 };
 
-    for (prevPtr = NULL, filePtr = tsdPtr->firstFileHandlerPtr; ;
-	 prevPtr = filePtr, filePtr = filePtr->nextPtr) {
-	if (filePtr == NULL) {
-	    return;
-	}
-	if (filePtr->fd == fd) {
-	    break;
-	}
+    if (!(flags & TCL_WINDOW_EVENTS)) {
+	return;
     }
 
-    /*
-     * Update the check masks for this file.
-     */
-
-    if (filePtr->mask & TCL_READABLE) {
-	FD_CLR( fd, &(tsdPtr->checkMasks.readable) );
-    }
-    if (filePtr->mask & TCL_WRITABLE) {
-	FD_CLR( fd, &(tsdPtr->checkMasks.writable) );
-    }
-    if (filePtr->mask & TCL_EXCEPTION) {
-	FD_CLR( fd, &(tsdPtr->checkMasks.exceptional) );
+    if (GetNumEventsInQueue((EventQueueRef)clientData)) {
+        Tcl_SetMaxBlockTime(&blockTime);
     }
-
-    /*
-     * Find current max fd.
-     */
-
-    if (fd+1 == tsdPtr->numFdBits) {
-	tsdPtr->numFdBits = 0;
-	for (i = fd-1; i >= 0; i--) {
-	    if ( FD_ISSET( i, &(tsdPtr->checkMasks.readable) )
-		 || FD_ISSET( i, &(tsdPtr->checkMasks.writable) )
-		 || FD_ISSET( i, &(tsdPtr->checkMasks.exceptional ) ) ) {
-		tsdPtr->numFdBits = i+1;
-		break;
-	    }
-	}
-    }
-
-    /*
-     * Clean up information in the callback record.
-     */
-
-    if (prevPtr == NULL) {
-	tsdPtr->firstFileHandlerPtr = filePtr->nextPtr;
-    } else {
-	prevPtr->nextPtr = filePtr->nextPtr;
-    }
-    ckfree((char *) filePtr);
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * FileHandlerEventProc --
- *
- *	This procedure is called by Tcl_ServiceEvent when a file event
- *	reaches the front of the event queue.  This procedure is
- *	responsible for actually handling the event by invoking the
- *	callback for the file handler.
- *
- * Results:
- *	Returns 1 if the event was handled, meaning it should be removed
- *	from the queue.  Returns 0 if the event was not handled, meaning
- *	it should stay on the queue.  The only time the event isn't
- *	handled is if the TCL_FILE_EVENTS flag bit isn't set.
- *
- * Side effects:
- *	Whatever the file handler's callback procedure does.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-FileHandlerEventProc(evPtr, flags)
-    Tcl_Event *evPtr;		/* Event to service. */
-    int flags;			/* Flags that indicate what events to
-				 * handle, such as TCL_FILE_EVENTS. */
-{
-    int mask;
-    FileHandler *filePtr;
-    FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) evPtr;
-    ThreadSpecificData *tsdPtr;
-
-    if (!(flags & TCL_FILE_EVENTS)) {
-	return 0;
-    }
-
-    /*
-     * Search through the file handlers to find the one whose handle matches
-     * the event.  We do this rather than keeping a pointer to the file
-     * handler directly in the event, so that the handler can be deleted
-     * while the event is queued without leaving a dangling pointer.
-     */
-
-    tsdPtr = TCL_TSD_INIT(&dataKey);
-    for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
-	 filePtr = filePtr->nextPtr) {
-	if (filePtr->fd != fileEvPtr->fd) {
-	    continue;
-	}
-
-	/*
-	 * The code is tricky for two reasons:
-	 * 1. The file handler's desired events could have changed
-	 *    since the time when the event was queued, so AND the
-	 *    ready mask with the desired mask.
-	 * 2. The file could have been closed and re-opened since
-	 *    the time when the event was queued.  This is why the
-	 *    ready mask is stored in the file handler rather than
-	 *    the queued event:  it will be zeroed when a new
-	 *    file handler is created for the newly opened file.
-	 */
 
-	mask = filePtr->readyMask & filePtr->mask;
-	filePtr->readyMask = 0;
-	if (mask != 0) {
-	    (*filePtr->proc)(filePtr->clientData, mask);
-	}
-	break;
-    }
-    return 1;
-}
-
 /*
  *----------------------------------------------------------------------
  *
- * Tcl_WaitForEvent --
+ * CarbonEventsCheckProc --
  *
- *	This function is called by Tcl_DoOneEvent to wait for new
- *	events on the message queue.  If the block time is 0, then
- *	Tcl_WaitForEvent just polls without blocking.
+ *	This procedure processes events sitting in the Carbon event
+ *	queue.
  *
  * Results:
- *	Returns -1 if the select would block forever, otherwise
- *	returns 0.
- *
- * Side effects:
- *	Queues file events that are detected by the select.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacOSXWaitForEvent(timePtr)
-    Tcl_Time *timePtr;		/* Maximum block time, or NULL. */
-{
-    FileHandler *filePtr;
-    FileHandlerEvent *fileEvPtr;
-    int mask;
-    int waitForFiles;
-    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-
-    /*
-     * Place this thread on the list of interested threads, signal the
-     * notifier thread, and wait for a response or a timeout.
-     */
-
-    Tcl_MutexLock(&notifierMutex);
-
-    waitForFiles = (tsdPtr->numFdBits > 0);
-    if (timePtr != NULL && timePtr->sec == 0 && timePtr->usec == 0) {
-	/*
-	 * Cannot emulate a polling select with a polling condition variable.
-	 * Instead, pretend to wait for files and tell the notifier
-	 * thread what we are doing.  The notifier thread makes sure
-	 * it goes through select with its select mask in the same state
-	 * as ours currently is.  We block until that happens.
-	 */
-
-	waitForFiles = 1;
-	tsdPtr->pollState = POLL_WANT;
-	timePtr = NULL;
-    } else {
-	tsdPtr->pollState = 0;
-    }
-
-    if (waitForFiles) {
-        /*
-         * Add the ThreadSpecificData structure of this thread to the list
-         * of ThreadSpecificData structures of all threads that are waiting
-         * on file events.
-         */
-
-
-        tsdPtr->nextPtr = waitingListPtr;
-        if (waitingListPtr) {
-            waitingListPtr->prevPtr = tsdPtr;
-        }
-        tsdPtr->prevPtr = 0;
-        waitingListPtr = tsdPtr;
-	tsdPtr->onList = 1;
-	
-	write(triggerPipe, "", 1);
-    }
-
-    FD_ZERO( &(tsdPtr->readyMasks.readable) );
-    FD_ZERO( &(tsdPtr->readyMasks.writable) );
-    FD_ZERO( &(tsdPtr->readyMasks.exceptional) );
-
-    if (!tsdPtr->eventReady) {
-        if (!tsdPtr->isMainLoop) {
-            Tcl_ConditionWait(&tsdPtr->waitCV, &notifierMutex, timePtr);
-        } else {
-            OSErr err;
-            EventRef eventRef;
-            EventTime waitTime;
-            
-            if (timePtr == NULL) {
-                waitTime = kEventDurationForever;
-            } else {
-                waitTime = timePtr->sec  * kEventDurationSecond 
-                         + timePtr->usec * kEventDurationMicrosecond;
-            }
-            Tcl_MutexUnlock(&notifierMutex);
-            err = ReceiveNextEvent(0, NULL, waitTime, false, &eventRef);
-            Tcl_MutexLock(&notifierMutex);
-        }
-    }
-    tsdPtr->eventReady = 0;
-
-    if (waitForFiles && tsdPtr->onList) {
-	/*
-	 * Remove the ThreadSpecificData structure of this thread from the
-	 * waiting list.  Alert the notifier thread to recompute its select
-	 * masks - skipping this caused a hang when trying to close a pipe
-	 * which the notifier thread was still doing a select on.
-	 */
-
-        if (tsdPtr->prevPtr) {
-            tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr;
-        } else {
-            waitingListPtr = tsdPtr->nextPtr;
-        }
-        if (tsdPtr->nextPtr) {
-            tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr;
-        }
-        tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
-	tsdPtr->onList = 0;
-	write(triggerPipe, "", 1);
-    }
-
-    
-    /*
-     * Queue all detected file events before returning.
-     */
-
-    for (filePtr = tsdPtr->firstFileHandlerPtr; (filePtr != NULL);
-	 filePtr = filePtr->nextPtr) {
-
-	mask = 0;
-	if ( FD_ISSET( filePtr->fd, &(tsdPtr->readyMasks.readable) ) ) {
-	    mask |= TCL_READABLE;
-	}
-	if ( FD_ISSET( filePtr->fd, &(tsdPtr->readyMasks.writable) ) ) {
-	    mask |= TCL_WRITABLE;
-	}
-	if ( FD_ISSET( filePtr->fd, &(tsdPtr->readyMasks.exceptional) ) ) {
-	    mask |= TCL_EXCEPTION;
-	}
-
-	if (!mask) {
-	    continue;
-	}
-
-	/*
-	 * Don't bother to queue an event if the mask was previously
-	 * non-zero since an event must still be on the queue.
-	 */
-
-	if (filePtr->readyMask == 0) {
-	    fileEvPtr = (FileHandlerEvent *) ckalloc(
-		sizeof(FileHandlerEvent));
-	    fileEvPtr->header.proc = FileHandlerEventProc;
-	    fileEvPtr->fd = filePtr->fd;
-	    Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL);
-	}
-	filePtr->readyMask = mask;
-    }
-    Tcl_MutexUnlock(&notifierMutex);
-    
-    /* 
-     * Also queue the Mac Events found...
-     */
-    if (tsdPtr->isMainLoop) {
-        TkMacOSXCountAndProcessMacEvents();
-    }
-    
-    return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * NotifierThreadProc --
- *
- *	This routine is the initial (and only) function executed by the
- *	special notifier thread.  Its job is to wait for file descriptors
- *	to become readable or writable or to have an exception condition
- *	and then to notify other threads who are interested in this
- *	information by signalling a condition variable.  Other threads
- *	can signal this notifier thread of a change in their interests
- *	by writing a single byte to a special pipe that the notifier
- *	thread is monitoring.
- *
- * Result:
- *	None.  Once started, this routine never exits.  It dies with
- *	the overall process.
+ *	None.
  *
  * Side effects:
- *	The trigger pipe used to signal the notifier thread is created
- *	when the notifier thread first starts.
+ *	Moves applicable queued Carbon events onto the Tcl event queue.
  *
  *----------------------------------------------------------------------
  */
 
 static void
-NotifierThreadProc(clientData)
-    ClientData clientData;	/* Not used. */
+CarbonEventsCheckProc(clientData, flags)
+    ClientData clientData;
+    int flags;
 {
-    ThreadSpecificData *tsdPtr;
-    fd_set readableMask;
-    fd_set writableMask;
-    fd_set exceptionalMask;
-    int fds[2];
-    int i, status, numFdBits = 0, receivePipe;
-    long found;
-    struct timeval poll = {0., 0.}, *timePtr;
-    char buf[2];
-
-    if (pipe(fds) != 0) {
-	panic("NotifierThreadProc: could not create trigger pipe.");
+    if (!(flags & TCL_WINDOW_EVENTS)) {
+	return;
     }
 
-    receivePipe = fds[0];
-
-    status = fcntl(receivePipe, F_GETFL);
-    status |= O_NONBLOCK;
-    if (fcntl(receivePipe, F_SETFL, status) < 0) {
-	panic("NotifierThreadProc: could not make receive pipe non blocking.");
-    }
-    status = fcntl(fds[1], F_GETFL);
-    status |= O_NONBLOCK;
-    if (fcntl(fds[1], F_SETFL, status) < 0) {
-	panic("NotifierThreadProc: could not make trigger pipe non blocking.");
-    }
-
-    /*
-     * Install the write end of the pipe into the global variable.
-     */
-
-    Tcl_MutexLock(&notifierMutex);
-    triggerPipe = fds[1];
-
-    /*
-     * Signal any threads that are waiting.
-     */
-
-    Tcl_ConditionNotify(&notifierCV);
-    Tcl_MutexUnlock(&notifierMutex);
-
-    /*
-     * Look for file events and report them to interested threads.
-     */
-
-    while (1) {
-
-	FD_ZERO( &readableMask );
-	FD_ZERO( &writableMask );
-	FD_ZERO( &exceptionalMask );
-
-	/*
-	 * Compute the logical OR of the select masks from all the
-	 * waiting notifiers.
-	 */
-
-	Tcl_MutexLock(&notifierMutex);
-	timePtr = NULL;
-        for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) {
-	    for ( i = tsdPtr->numFdBits-1; i >= 0; --i ) {
-		if ( FD_ISSET( i, &(tsdPtr->checkMasks.readable) ) ) {
-		    FD_SET( i, &readableMask );
-		}
-		if ( FD_ISSET( i, &(tsdPtr->checkMasks.writable) ) ) {
-		    FD_SET( i, &writableMask );
-		}
-		if ( FD_ISSET( i, &(tsdPtr->checkMasks.exceptional) ) ) {
-		    FD_SET( i, &exceptionalMask );
-		}
-	    }
-	    if ( tsdPtr->numFdBits > numFdBits ) {
-		numFdBits = tsdPtr->numFdBits;
-	    }
-	    if (tsdPtr->pollState & POLL_WANT) {
-		/*
-		 * Here we make sure we go through select() with the same
-		 * mask bits that were present when the thread tried to poll.
-		 */
-
-		tsdPtr->pollState |= POLL_DONE;
-		timePtr = &poll;
-	    }
-	}
-	Tcl_MutexUnlock(&notifierMutex);
-
-	/*
-	 * Set up the select mask to include the receive pipe.
-	 */
-
-	if ( receivePipe >= numFdBits ) {
-	    numFdBits = receivePipe + 1;
-	}
-	FD_SET( receivePipe, &readableMask );
-
-	if ( select( numFdBits, &readableMask, &writableMask,
-		     &exceptionalMask, timePtr) == -1 ) {
-	    /*
-	     * Try again immediately on an error.
-	     */
-
-	    continue;
-        }
-
-	/*
-	 * Alert any threads that are waiting on a ready file descriptor.
-	 */
-
-	Tcl_MutexLock(&notifierMutex);
-        for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) {
-	    found = 0;
-
-	    for ( i = tsdPtr->numFdBits-1; i >= 0; --i ) {
-		if ( FD_ISSET( i, &(tsdPtr->checkMasks.readable) )
-		     && FD_ISSET( i, &readableMask ) ) {
-		    FD_SET( i, &(tsdPtr->readyMasks.readable) );
-		    found = 1;
-		}
-		if ( FD_ISSET( i, &(tsdPtr->checkMasks.writable) )
-		     && FD_ISSET( i, &writableMask ) ) {
-		    FD_SET( i, &(tsdPtr->readyMasks.writable) );
-		    found = 1;
-		}
-		if ( FD_ISSET( i, &(tsdPtr->checkMasks.exceptional) )
-		     && FD_ISSET( i, &exceptionalMask ) ) {
-		    FD_SET( i, &(tsdPtr->readyMasks.exceptional) );
-		    found = 1;
-		}
-	    }
-
-            if (found || (tsdPtr->pollState & POLL_DONE)) {
-                tsdPtr->eventReady = 1;
-		if (tsdPtr->onList) {
-		    /*
-		     * Remove the ThreadSpecificData structure of this
-		     * thread from the waiting list. This prevents us from
-		     * continuously spining on select until the other
-		     * threads runs and services the file event.
-		     */
-
-		    if (tsdPtr->prevPtr) {
-			tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr;
-		    } else {
-			waitingListPtr = tsdPtr->nextPtr;
-		    }
-		    if (tsdPtr->nextPtr) {
-			tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr;
-		    }
-		    tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
-		    tsdPtr->onList = 0;
-		    tsdPtr->pollState = 0;
-		}
-                if (tsdPtr->isMainLoop) {
-                    OSErr err;
-                    
-                    /* We need to wake up the main loop, and let it have the event. */
-                    EventRef fakeEvent = TkMacOSXCreateFakeEvent();
-                    EventQueueRef mainEventQueue = GetMainEventQueue();
-                    
-                    err = PostEventToQueue(mainEventQueue, fakeEvent,
-                                           kEventPriorityHigh);
-                    ReleaseEvent(fakeEvent);
-                } else {
-                    Tcl_ConditionNotify(&tsdPtr->waitCV);
-                }
-            }
-        }
-	Tcl_MutexUnlock(&notifierMutex);
-
-	/*
-	 * Consume the next byte from the notifier pipe if the pipe was
-	 * readable.  Note that there may be multiple bytes pending, but
-	 * to avoid a race condition we only read one at a time.
-	 */
-
-	if ( FD_ISSET( receivePipe, &readableMask ) ) {
-	    i = read(receivePipe, buf, 1);
-
-	    if ((i == 0) || ((i == 1) && (buf[0] == 'q'))) {
-		/*
-		 * Someone closed the write end of the pipe or sent us a
-		 * Quit message [Bug: 4139] and then closed the write end
-		 * of the pipe so we need to shut down the notifier thread.
-		 */
-
-		break;
-	    }
-	}
-    }
-
-    /*
-     * Clean up the read end of the pipe and signal any threads waiting on
-     * termination of the notifier thread.
-     */
-
-    close(receivePipe);
-    Tcl_MutexLock(&notifierMutex);
-    triggerPipe = -1;
-    Tcl_ConditionNotify(&notifierCV);
-    Tcl_MutexUnlock(&notifierMutex);
-
-    Tcl_ExitThread (0);
-}
-
-EventRef 
-TkMacOSXCreateFakeEvent ()
-{
-    EventKind       eKind;
-    EventClass      eClass;
-    EventTime       eTime;
-    EventRef        eventRef;
-    EventAttributes flags;
-    eClass = kEventClassWish;
-    eKind = 0xffff;
-    eTime = GetLastUserEventTime() + 0.001;
-    flags = kEventAttributeUserEvent;
-    if (CreateEvent(NULL,eClass,eKind,eTime,flags,&eventRef) != noErr) {
-        fprintf(stderr,"CreateEvent failed\n");
-        return NULL;
+    if (GetNumEventsInQueue((EventQueueRef)clientData)) {
+        TkMacOSXCountAndProcessMacEvents();
     }
-    return eventRef;
 }
Index: macosx/tkMacOSXWm.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXWm.c,v
retrieving revision 1.7.2.7
diff -u -p -u -p -r1.7.2.7 tkMacOSXWm.c
--- macosx/tkMacOSXWm.c	12 Mar 2005 00:49:38 -0000	1.7.2.7
+++ macosx/tkMacOSXWm.c	14 May 2005 19:16:13 -0000
@@ -852,7 +852,7 @@ Tcl_Obj *CONST objv[];	/* Argument objec
 		break;
 	    case WmAttrTitlePathIdx:
                 err = FSPathMakeRef(
-		    Tcl_GetStringFromObj(objv[i+1], NULL), 
+		    (unsigned char*) Tcl_GetStringFromObj(objv[i+1], NULL), 
 		    &ref, &isDirectory);
                 if (err == noErr) {
 		    err = FSNewAlias(NULL, &ref, &alias);
@@ -945,7 +945,7 @@ static void WmAttrGetTitlePath(WindowRef
 	err = FSRefMakePath(&ref, path, 2048);
     }
     if (err == noErr) {
-	Tcl_AppendToObj(result, path, -1);
+	Tcl_AppendToObj(result, (char*) path, -1);
     } else {
 	Tcl_AppendToObj(result, "{}", -1);
     }
@@ -1600,7 +1600,7 @@ Tcl_Obj *CONST objv[];	/* Argument objec
         AliasHandle alias;
         FSRef ref;
         Boolean isDirectory;
-        err = FSPathMakeRef(Tcl_GetStringFromObj(objv[3], NULL), &ref, &isDirectory);
+        err = FSPathMakeRef((unsigned char*) Tcl_GetStringFromObj(objv[3], NULL), &ref, &isDirectory);
         if (err == noErr) {
             err = FSNewAlias(NULL, &ref, &alias);
             if (err == noErr) {
@@ -1814,7 +1814,9 @@ WmIconphotoCmd(tkwin, winPtr, interp, ob
     int objc;			/* Number of arguments. */
     Tcl_Obj *CONST objv[];	/* Argument objects. */
 {
+#if 0 /* Unused */
     register WmInfo *wmPtr = winPtr->wmInfoPtr;
+#endif
     Tk_PhotoHandle photo;
     int i, width, height, isDefault = 0;
 
@@ -2612,7 +2614,7 @@ Tcl_Obj *CONST objv[];	/* Argument objec
                                  (char *) NULL);
                 return TCL_ERROR;
             }
-            if (wmPtr->master != NULL) {
+            if (wmPtr->master != None) {
                 Tcl_AppendResult(interp, "can't iconify \"",
                                  winPtr->pathName,
                                  "\": it is a transient", (char *) NULL);
@@ -4491,7 +4493,7 @@ TkSetWMName(
     }
     
     if (strlen(titleUid) > 0) {
-        title = CFStringCreateWithBytes(NULL, titleUid, strlen(titleUid), 
+        title = CFStringCreateWithBytes(NULL, (unsigned char*) titleUid, strlen(titleUid), 
                 kCFStringEncodingUTF8, false); 
     } else {
     	title = NULL;
Index: macosx/tkMacOSXXStubs.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/tkMacOSXXStubs.c,v
retrieving revision 1.2.2.4
diff -u -p -u -p -r1.2.2.4 tkMacOSXXStubs.c
--- macosx/tkMacOSXXStubs.c	13 Nov 2004 03:42:10 -0000	1.2.2.4
+++ macosx/tkMacOSXXStubs.c	14 May 2005 19:16:13 -0000
@@ -365,7 +365,7 @@ XGetImage(display, d, x, y, width, heigh
     int format;
 { 
     XImage *   imagePtr = NULL;
-    Pixmap     pixmap = NULL;
+    Pixmap     pixmap = (Pixmap) NULL;
     Tk_Window  win = (Tk_Window) ((MacDrawable *) d)->winPtr;
     GC         gc;
     int        depth = 32;
Index: macosx/Wish.pbproj/project.pbxproj
===================================================================
RCS file: /cvsroot/tktoolkit/tk/macosx/Wish.pbproj/project.pbxproj,v
retrieving revision 1.18.2.21
diff -u -p -u -p -r1.18.2.21 project.pbxproj
--- macosx/Wish.pbproj/project.pbxproj	9 Apr 2005 11:19:17 -0000	1.18.2.21
+++ macosx/Wish.pbproj/project.pbxproj	14 May 2005 19:16:13 -0000
@@ -92,12 +92,6 @@
 			settings = {
 			};
 		};
-		F51D903E0181474301DC9062 = {
-			fileRef = F5875C7B016FEF1D01DC9062;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		F51D903F018149BD01DC9062 = {
 			buildActionMask = 2147483647;
 			dstPath = "Versions/$(FRAMEWORK_VERSION)/Headers/X11";
@@ -177,7 +171,7 @@
 			isa = PBXShellScriptBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "if [ \"${BUILD_STYLE}\" = \"Development\" ]; then\n\t# keep copy of debug library around, so that\n\t# Deployment build can be installed on top\n\t# of Development build without overwriting it\n\tcd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\n\tcp -fp \"${PRODUCT_NAME}\" \"${PRODUCT_NAME}_debug\"\n\tln -fs \"Versions/Current/${PRODUCT_NAME}_debug\" ../..\n\tcp -fp \"libtkstub${FRAMEWORK_VERSION}.a\" \"libtkstub${FRAMEWORK_VERSION}g.a\"\n\n\t# force Deployment build to be relinked next time\n\tif [ -f \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\" ]; then\n\t    touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\"\n\tfi\nelse\n\t# force Development build to be relinked next time\n\tif [ -f \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\" ]; then\n\t    touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\"\n\tfi\nfi\n\n# fixup Framework structure\ncd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\nln -fs `ls libtkstub* | sed -e \"s|.*|Versions/${FRAMEWORK_VERSION}/&|\"` ../..\nln -fs \"Versions/Current/tkConfig.sh\" ../..\nranlib libtkstub${FRAMEWORK_VERSION}*.a\n\n# create pkgIndex\n( echo \"if {[package vcompare [package provide Tcl] ${FRAMEWORK_VERSION}] != 0} { return }\" && \\\n  echo \"package ifneeded Tk ${FRAMEWORK_VERSION} [list load [file join \\$dir .. .. Tk] Tk]\" \\\n) > \"Resources/Scripts/pkgIndex.tcl\"";
+			shellScript = "if [ \"${BUILD_STYLE}\" = \"Development\" ]; then\n\t# keep copy of debug library around, so that\n\t# Deployment build can be installed on top\n\t# of Development build without overwriting it\n\tcd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\n\tcp -fp \"${PRODUCT_NAME}\" \"${PRODUCT_NAME}_debug\"\n\tln -f \"Versions/Current/${PRODUCT_NAME}_debug\" ../..\n\tln -f \"libtkstub${FRAMEWORK_VERSION}.a\" \"libtkstub${FRAMEWORK_VERSION}g.a\"\n\n\t# force Deployment build to be relinked next time\n\tif [ -f \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\" ]; then\n\t    touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\"\n\tfi\nelse\n\t# force Development build to be relinked next time\n\tif [ -f \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\" ]; then\n\t    touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\"\n\tfi\nfi\n\n# fixup Framework structure\ncd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\nln -fs `ls libtkstub* | sed -e \"s|.*|Versions/${FRAMEWORK_VERSION}/&|\"` ../..\nln -fs \"Versions/Current/tkConfig.sh\" ../..\nranlib libtkstub${FRAMEWORK_VERSION}*.a\n\n# create pkgIndex\n( echo \"if {[package vcompare [package provide Tcl] ${FRAMEWORK_VERSION}] != 0} { return }\" && \\\n  echo \"package ifneeded Tk ${FRAMEWORK_VERSION} [list load [file join \\$dir .. .. Tk] Tk]\" \\\n) > \"Resources/Scripts/pkgIndex.tcl\"";
 		};
 		F537552A016C352C01DC9062 = {
 			buildSettings = {
@@ -222,6 +216,7 @@
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_LDFLAGS = "\U0001-prebind";
+				TCL_DBGX = g;
 				TEMP_DIR = "${OBJROOT}/Development.build/$(PROJECT_NAME).build/$(TARGET_NAME).build";
 				UNSTRIPPED_PRODUCT = YES;
 				ZERO_LINK = YES;
@@ -235,6 +230,7 @@
 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
 				OPTIMIZATION_CFLAGS = "-Os";
 				OTHER_LDFLAGS = "\U0001-prebind";
+				TCL_DBGX = "";
 				TEMP_DIR = "${OBJROOT}/Deployment.build/$(PROJECT_NAME).build/$(TARGET_NAME).build";
 				ZERO_LINK = NO;
 			};
@@ -1870,6 +1866,7 @@
 		F53755DF016C38D201DC9062 = {
 			buildPhases = (
 				F5877FB7031F97ED016F146B,
+				F92CCC75080CEBA800E72D64,
 				F53755E0016C38D201DC9062,
 				F53755E1016C38D301DC9062,
 				F53755E2016C38D301DC9062,
@@ -1890,13 +1887,13 @@
 				DYLIB_INSTALL_PATH = /Library/Frameworks;
 				FRAMEWORK_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)\"";
 				FRAMEWORK_VERSION = 8.4;
-				GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' | sed -e 's| -DTCL_WIDE_INT_TYPE=long. long||'` -U_REENTRANT";
+				GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' -e 's|\\\\\\\\\\\\ |_|g' -e 's|TCL_WIDE_INT_TYPE|BOGUS_&|'` -U_REENTRANT";
 				HEADER_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)/Tcl.framework/Headers\" \"$(TCL_FRAMEWORK_DIR)/Tcl.framework/PrivateHeaders\" . ../bitmaps ../generic ../xlib";
 				INSTALL_PATH = "${DYLIB_INSTALL_PATH}";
-				LIBRARY_SEARCH_PATHS = "";
+				LIBRARY_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)/Tcl.framework\"";
 				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "-DMAC_OSX_TK -DTCL_WIDE_INT_TYPE=\"long long\"";
-				OTHER_LDFLAGS = "-seg1addr 0xb000000";
+				OTHER_CFLAGS = "-DMAC_OSX_TK -DUSE_TCL_STUBS -DTCL_WIDE_INT_TYPE=\"long long\"";
+				OTHER_LDFLAGS = "-ltclstub${FRAMEWORK_VERSION}${TCL_DBGX} -seg1addr 0xb000000 -Wl,-search_paths_first -Wl,-unexported_symbols_list \"${TEMP_DIR}/tclstub.exp\"";
 				OTHER_LIBTOOL_FLAGS = "";
 				OTHER_REZFLAGS = "-i \"$(TCL_FRAMEWORK_DIR)/Tcl.framework/Headers\" -i \"../generic\"";
 				PRECOMPILE_PREFIX_HEADER = YES;
@@ -1908,7 +1905,7 @@
 				TCLTKMAN2HTML = "";
 				TCL_FRAMEWORK_DIR = "$(SYMROOT)/../tcl";
 				USE_GCC3_PFE_SUPPORT = YES;
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas  -Wno-deprecated-declarations";
 				WRAPPER_EXTENSION = framework;
 			};
 			dependencies = (
@@ -2135,7 +2132,6 @@ MacOS X Port by Jim Ingham &lt;jingham@a
 		F53755E3016C38D301DC9062 = {
 			buildActionMask = 2147483647;
 			files = (
-				F51D903E0181474301DC9062,
 				F537567E016C3ADB01DC9062,
 				F50D96130196176E01DC9062,
 			);
@@ -3294,7 +3290,7 @@ MacOS X Port by Jim Ingham &lt;jingham@a
 				DYLIB_INSTALL_PATH = /Library/Frameworks;
 				FRAMEWORK_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)\" \"$(SYMROOT)\"";
 				FRAMEWORK_VERSION = 8.4;
-				GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' | sed -e 's| -DTCL_WIDE_INT_TYPE=long. long||'` -U_REENTRANT";
+				GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' -e 's|\\\\\\\\\\\\ |_|g' -e 's|TCL_WIDE_INT_TYPE|BOGUS_&|'` -U_REENTRANT";
 				HEADER_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)/Tcl.framework/Headers\" \"$(TCL_FRAMEWORK_DIR)/Tcl.framework/PrivateHeaders\" . ../generic ../xlib";
 				INSTALL_PATH = "${APPLICATION_INSTALL_PATH}";
 				LIBRARY_SEARCH_PATHS = "";
@@ -3307,7 +3303,7 @@ MacOS X Port by Jim Ingham &lt;jingham@a
 				SYMROOT = "${SRCROOT}/../../build/tk";
 				TCL_FRAMEWORK_DIR = "$(SYMROOT)/../tcl";
 				USE_GCC3_PFE_SUPPORT = NO;
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas  -Wno-deprecated-declarations";
 				WRAPPER_EXTENSION = app;
 			};
 			dependencies = (
@@ -3486,7 +3482,7 @@ MacOS X Port by Jim Ingham &lt;jingham@a
 				F59D847903390D7E016F146B,
 			);
 			buildSettings = {
-				GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' | sed -e 's| -DTCL_WIDE_INT_TYPE=long. long||'` -U_REENTRANT";
+				GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' -e 's|\\\\\\\\\\\\ |_|g' -e 's|TCL_WIDE_INT_TYPE|BOGUS_&|'` -U_REENTRANT";
 				HEADER_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)/Tcl.framework/Headers\" \"$(TCL_FRAMEWORK_DIR)/Tcl.framework/PrivateHeaders\" . ../generic ../xlib";
 				LIBRARY_STYLE = STATIC;
 				OPTIMIZATION_CFLAGS = "-O0";
@@ -3498,7 +3494,7 @@ MacOS X Port by Jim Ingham &lt;jingham@a
 				SECTORDER_FLAGS = "";
 				SYMROOT = "${SRCROOT}/../../build/tk";
 				TCL_FRAMEWORK_DIR = "$(SYMROOT)/../tcl";
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas  -Wno-deprecated-declarations";
 			};
 			dependencies = (
 			);
@@ -4259,6 +4255,15 @@ MacOS X Port by Jim Ingham &lt;jingham@a
 //F92
 //F93
 //F94
+		F92CCC75080CEBA800E72D64 = {
+			buildActionMask = 2147483647;
+			files = (
+			);
+			isa = PBXShellScriptBuildPhase;
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "# extract global symbols in libtclstub so that we can unexport them from Tk.framework\nnm -gjp \"${TCL_FRAMEWORK_DIR}/Tcl.framework/libtclstub${FRAMEWORK_VERSION}${TCL_DBGX}.a\" | tail +3 > \"${TEMP_DIR}/tclstub.exp\"";
+		};
 		F92ED9910403D0F0006F146B = {
 			fileEncoding = 5;
 			isa = PBXFileReference;
Index: unix/configure
===================================================================
RCS file: /cvsroot/tktoolkit/tk/unix/configure,v
retrieving revision 1.65.2.26
diff -u -p -u -p -r1.65.2.26 configure
--- unix/configure	7 May 2005 00:03:00 -0000	1.65.2.26
+++ unix/configure	14 May 2005 19:16:13 -0000
@@ -31,6 +31,8 @@ ac_help="$ac_help
 ac_help="$ac_help
   --enable-64bit-vis      enable 64bit Sparc VIS support"
 ac_help="$ac_help
+  --enable-corefoundation use CoreFoundation API [--enable-corefoundation]"
+ac_help="$ac_help
   --disable-load          disallow dynamic loading and "load" command"
 ac_help="$ac_help
   --enable-symbols        build with debugging symbols [--disable-symbols]"
@@ -576,7 +578,7 @@ if test "${with_tcl+set}" = set; then
 fi
 
 	echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6
-echo "configure:580: checking for Tcl configuration" >&5
+echo "configure:582: 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
@@ -657,7 +659,7 @@ fi
 
 
     echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6
-echo "configure:661: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
+echo "configure:663: 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
@@ -734,7 +736,7 @@ TK_SRC_DIR=`cd $srcdir/..; pwd`
 
 
 	echo $ac_n "checking whether to use symlinks for manpages""... $ac_c" 1>&6
-echo "configure:738: checking whether to use symlinks for manpages" >&5
+echo "configure:740: checking whether to use symlinks for manpages" >&5
 	# Check whether --enable-man-symlinks or --disable-man-symlinks was given.
 if test "${enable_man_symlinks+set}" = set; then
   enableval="$enable_man_symlinks"
@@ -746,7 +748,7 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking whether to compress the manpages""... $ac_c" 1>&6
-echo "configure:750: checking whether to compress the manpages" >&5
+echo "configure:752: checking whether to compress the manpages" >&5
 	# Check whether --enable-man-compression or --disable-man-compression was given.
 if test "${enable_man_compression+set}" = set; then
   enableval="$enable_man_compression"
@@ -759,7 +761,7 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 	if test "$enableval" != "no"; then
 		echo $ac_n "checking for compressed file suffix""... $ac_c" 1>&6
-echo "configure:763: checking for compressed file suffix" >&5
+echo "configure:765: checking for compressed file suffix" >&5
 		touch TeST
 		$enableval TeST
 		Z=`ls TeST* | sed 's/^....//'`
@@ -769,7 +771,7 @@ echo "configure:763: checking for compre
 	fi
 
 	echo $ac_n "checking whether to add a package name suffix for the manpages""... $ac_c" 1>&6
-echo "configure:773: checking whether to add a package name suffix for the manpages" >&5
+echo "configure:775: checking whether to add a package name suffix for the manpages" >&5
 	# Check whether --enable-man-suffix or --disable-man-suffix was given.
 if test "${enable_man_suffix+set}" = set; then
   enableval="$enable_man_suffix"
@@ -797,7 +799,7 @@ fi
 # 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:801: checking for $ac_word" >&5
+echo "configure:803: 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
@@ -827,7 +829,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:831: checking for $ac_word" >&5
+echo "configure:833: 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
@@ -878,7 +880,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:882: checking for $ac_word" >&5
+echo "configure:884: 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
@@ -910,7 +912,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:914: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:916: 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.
@@ -921,12 +923,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 925 "configure"
+#line 927 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:932: \"$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
@@ -952,12 +954,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:956: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:958: 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:961: checking whether we are using GNU C" >&5
+echo "configure:963: 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
@@ -966,7 +968,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:970: \"$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:972: \"$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
@@ -985,7 +987,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:989: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:991: 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
@@ -1018,7 +1020,7 @@ fi
 
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1022: checking how to run the C preprocessor" >&5
+echo "configure:1024: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1033,13 +1035,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 1037 "configure"
+#line 1039 "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:1043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1045: \"$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
   :
@@ -1050,13 +1052,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1054 "configure"
+#line 1056 "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:1060: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1062: \"$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
   :
@@ -1067,13 +1069,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1071 "configure"
+#line 1073 "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:1077: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1079: \"$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
   :
@@ -1101,17 +1103,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:1105: checking for $ac_hdr" >&5
+echo "configure:1107: 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 1110 "configure"
+#line 1112 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1115: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1117: \"$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*
@@ -1146,18 +1148,18 @@ done
 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:1150: checking if the compiler understands -pipe" >&5
+echo "configure:1152: checking if the compiler understands -pipe" >&5
   OLDCC="$CC"  
   CC="$CC -pipe"
   cat > conftest.$ac_ext <<EOF
-#line 1154 "configure"
+#line 1156 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1161: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1163: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -1177,7 +1179,7 @@ fi
 
 
     echo $ac_n "checking for building with threads""... $ac_c" 1>&6
-echo "configure:1181: checking for building with threads" >&5
+echo "configure:1183: 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"
@@ -1219,7 +1221,7 @@ EOF
 EOF
 
 	echo $ac_n "checking for pthread_mutex_init in -lpthread""... $ac_c" 1>&6
-echo "configure:1223: checking for pthread_mutex_init in -lpthread" >&5
+echo "configure:1225: 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
@@ -1227,7 +1229,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1231 "configure"
+#line 1233 "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
@@ -1238,7 +1240,7 @@ int main() {
 pthread_mutex_init()
 ; return 0; }
 EOF
-if { (eval echo configure:1242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1244: \"$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
@@ -1266,7 +1268,7 @@ fi
 	    # 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:1270: checking for __pthread_mutex_init in -lpthread" >&5
+echo "configure:1272: 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
@@ -1274,7 +1276,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1278 "configure"
+#line 1280 "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
@@ -1285,7 +1287,7 @@ int main() {
 __pthread_mutex_init()
 ; return 0; }
 EOF
-if { (eval echo configure:1289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1291: \"$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
@@ -1313,7 +1315,7 @@ fi
 	    THREADS_LIBS=" -lpthread"
 	else
 	    echo $ac_n "checking for pthread_mutex_init in -lpthreads""... $ac_c" 1>&6
-echo "configure:1317: checking for pthread_mutex_init in -lpthreads" >&5
+echo "configure:1319: 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
@@ -1321,7 +1323,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthreads  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1325 "configure"
+#line 1327 "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
@@ -1332,7 +1334,7 @@ int main() {
 pthread_mutex_init()
 ; return 0; }
 EOF
-if { (eval echo configure:1336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1338: \"$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
@@ -1358,7 +1360,7 @@ fi
 		THREADS_LIBS=" -lpthreads"
 	    else
 		echo $ac_n "checking for pthread_mutex_init in -lc""... $ac_c" 1>&6
-echo "configure:1362: checking for pthread_mutex_init in -lc" >&5
+echo "configure:1364: 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
@@ -1366,7 +1368,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1370 "configure"
+#line 1372 "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
@@ -1377,7 +1379,7 @@ int main() {
 pthread_mutex_init()
 ; return 0; }
 EOF
-if { (eval echo configure:1381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1383: \"$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
@@ -1400,7 +1402,7 @@ fi
 
 	    	if test "$tcl_ok" = "no"; then
 		    echo $ac_n "checking for pthread_mutex_init in -lc_r""... $ac_c" 1>&6
-echo "configure:1404: checking for pthread_mutex_init in -lc_r" >&5
+echo "configure:1406: checking for pthread_mutex_init in -lc_r" >&5
 ac_lib_var=`echo c_r'_'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
@@ -1408,7 +1410,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lc_r  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1412 "configure"
+#line 1414 "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
@@ -1419,7 +1421,7 @@ int main() {
 pthread_mutex_init()
 ; return 0; }
 EOF
-if { (eval echo configure:1423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1425: \"$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
@@ -1459,12 +1461,12 @@ fi
 	for ac_func in pthread_attr_setstacksize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1463: checking for $ac_func" >&5
+echo "configure:1465: 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 1468 "configure"
+#line 1470 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1487,7 +1489,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1493: \"$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
@@ -1514,12 +1516,12 @@ done
 	for ac_func in pthread_atfork
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1518: checking for $ac_func" >&5
+echo "configure:1520: 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 1523 "configure"
+#line 1525 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1542,7 +1544,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1548: \"$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
@@ -1570,12 +1572,12 @@ done
 	for ac_func in readdir_r
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1574: checking for $ac_func" >&5
+echo "configure:1576: 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 1579 "configure"
+#line 1581 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1598,7 +1600,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1604: \"$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
@@ -1624,14 +1626,14 @@ done
 
 	if test "x$ac_cv_func_readdir_r" = "xyes"; then
             echo $ac_n "checking how many args readdir_r takes""... $ac_c" 1>&6
-echo "configure:1628: checking how many args readdir_r takes" >&5
+echo "configure:1630: checking how many args readdir_r takes" >&5
 	    # IRIX 5.3 has a 2 arg version of readdir_r
 	    # while other systems have a 3 arg version.
 	    if eval "test \"`echo '$''{'tcl_cv_two_arg_readdir_r'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1635 "configure"
+#line 1637 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <sys/types.h>
@@ -1646,7 +1648,7 @@ int main() {
 readdir_r(NULL, NULL);
 ; return 0; }
 EOF
-if { (eval echo configure:1650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_cv_two_arg_readdir_r=yes
 else
@@ -1662,7 +1664,7 @@ fi
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1666 "configure"
+#line 1668 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <sys/types.h>
@@ -1677,7 +1679,7 @@ int main() {
 readdir_r(NULL, NULL, NULL);
 ; return 0; }
 EOF
-if { (eval echo configure:1681: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1683: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_cv_three_arg_readdir_r=yes
 else
@@ -1721,7 +1723,7 @@ LIBS="$LIBS$THREADS_LIBS"
 
 
     echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
-echo "configure:1725: checking how to build libraries" >&5
+echo "configure:1727: 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"
@@ -1754,7 +1756,7 @@ EOF
 # 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:1758: checking for $ac_word" >&5
+echo "configure:1760: 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
@@ -1786,7 +1788,7 @@ fi
     # Step 0.a: Enable 64 bit support?
 
     echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6
-echo "configure:1790: checking if 64bit support is requested" >&5
+echo "configure:1792: 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"
@@ -1806,7 +1808,7 @@ fi
     # 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:1810: checking if 64bit Sparc VIS support is requested" >&5
+echo "configure:1812: 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"
@@ -1830,7 +1832,7 @@ fi
     # 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:1834: checking system version (for dynamic loading)" >&5
+echo "configure:1836: 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
@@ -1856,7 +1858,7 @@ echo "configure:1834: checking system ve
     # Linux can use either -ldl or -ldld for dynamic loading.
 
     echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:1860: checking for dlopen in -ldl" >&5
+echo "configure:1862: 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
@@ -1864,7 +1866,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1868 "configure"
+#line 1870 "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
@@ -1875,7 +1877,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:1879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1881: \"$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
@@ -1923,7 +1925,7 @@ fi
     # 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:1927: checking for $ac_word" >&5
+echo "configure:1929: 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
@@ -2033,7 +2035,7 @@ fi
 	    # known GMT value.
 
 	    echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6
-echo "configure:2037: checking for gettimeofday in -lbsd" >&5
+echo "configure:2039: 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
@@ -2041,7 +2043,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2045 "configure"
+#line 2047 "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
@@ -2052,7 +2054,7 @@ int main() {
 gettimeofday()
 ; return 0; }
 EOF
-if { (eval echo configure:2056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2058: \"$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
@@ -2095,7 +2097,7 @@ EOF
 	    # is always linked to, for compatibility.
 	    #-----------------------------------------------------------
 	    echo $ac_n "checking for inet_ntoa in -lbind""... $ac_c" 1>&6
-echo "configure:2099: checking for inet_ntoa in -lbind" >&5
+echo "configure:2101: checking for inet_ntoa in -lbind" >&5
 ac_lib_var=`echo bind'_'inet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2103,7 +2105,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2107 "configure"
+#line 2109 "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
@@ -2114,7 +2116,7 @@ int main() {
 inet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2120: \"$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
@@ -2180,7 +2182,7 @@ EOF
 
 	    SHLIB_SUFFIX=".sl"
 	    echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:2184: checking for shl_load in -ldld" >&5
+echo "configure:2186: 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
@@ -2188,7 +2190,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2192 "configure"
+#line 2194 "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
@@ -2199,7 +2201,7 @@ int main() {
 shl_load()
 ; return 0; }
 EOF
-if { (eval echo configure:2203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2205: \"$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
@@ -2267,7 +2269,7 @@ fi
 	HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
 	    SHLIB_SUFFIX=".sl"
 	    echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:2271: checking for shl_load in -ldld" >&5
+echo "configure:2273: 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
@@ -2275,7 +2277,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2279 "configure"
+#line 2281 "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
@@ -2286,7 +2288,7 @@ int main() {
 shl_load()
 ; return 0; }
 EOF
-if { (eval echo configure:2290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2292: \"$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
@@ -2410,17 +2412,17 @@ fi
 	    else
 		ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dld.h""... $ac_c" 1>&6
-echo "configure:2414: checking for dld.h" >&5
+echo "configure:2416: 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 2419 "configure"
+#line 2421 "configure"
 #include "confdefs.h"
 #include <dld.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2424: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2426: \"$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*
@@ -2484,17 +2486,17 @@ EOF
 	    else
 		ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dld.h""... $ac_c" 1>&6
-echo "configure:2488: checking for dld.h" >&5
+echo "configure:2490: 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 2493 "configure"
+#line 2495 "configure"
 #include "confdefs.h"
 #include <dld.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2500: \"$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*
@@ -2550,17 +2552,17 @@ fi
 	    # 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:2554: checking for dlfcn.h" >&5
+echo "configure:2556: 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 2559 "configure"
+#line 2561 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2564: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2566: \"$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*
@@ -2587,9 +2589,9 @@ if eval "test \"`echo '$ac_cv_header_'$a
 		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
 		LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
 		echo $ac_n "checking for ELF""... $ac_c" 1>&6
-echo "configure:2591: checking for ELF" >&5
+echo "configure:2593: checking for ELF" >&5
 		cat > conftest.$ac_ext <<EOF
-#line 2593 "configure"
+#line 2595 "configure"
 #include "confdefs.h"
 
 #ifdef __ELF__
@@ -2663,9 +2665,9 @@ fi
 		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
 		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
 		echo $ac_n "checking for ELF""... $ac_c" 1>&6
-echo "configure:2667: checking for ELF" >&5
+echo "configure:2669: checking for ELF" >&5
 		cat > conftest.$ac_ext <<EOF
-#line 2669 "configure"
+#line 2671 "configure"
 #include "confdefs.h"
 
 #ifdef __ELF__
@@ -2724,7 +2726,7 @@ rm -f conftest*
 	    SHLIB_CFLAGS="-fno-common"
 	    SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
 	    echo $ac_n "checking if ld accepts -single_module flag""... $ac_c" 1>&6
-echo "configure:2728: checking if ld accepts -single_module flag" >&5
+echo "configure:2730: checking if ld accepts -single_module flag" >&5
 if eval "test \"`echo '$''{'tcl_cv_ld_single_module'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2732,14 +2734,14 @@ else
 	        hold_ldflags=$LDFLAGS
 	        LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
 	        cat > conftest.$ac_ext <<EOF
-#line 2736 "configure"
+#line 2738 "configure"
 #include "confdefs.h"
 
 int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   tcl_cv_ld_single_module=yes
 else
@@ -2762,7 +2764,7 @@ echo "$ac_t""$tcl_cv_ld_single_module" 1
 	    DL_LIBS=""
 	    LDFLAGS="$LDFLAGS -prebind"
 	    echo $ac_n "checking if ld accepts -search_paths_first flag""... $ac_c" 1>&6
-echo "configure:2766: checking if ld accepts -search_paths_first flag" >&5
+echo "configure:2768: checking if ld accepts -search_paths_first flag" >&5
 if eval "test \"`echo '$''{'tcl_cv_ld_search_paths_first'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2770,14 +2772,14 @@ else
 	        hold_ldflags=$LDFLAGS
 	        LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
 	        cat > conftest.$ac_ext <<EOF
-#line 2774 "configure"
+#line 2776 "configure"
 #include "confdefs.h"
 
 int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   tcl_cv_ld_search_paths_first=yes
 else
@@ -2801,13 +2803,153 @@ echo "$ac_t""$tcl_cv_ld_search_paths_fir
 	    PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
 	    TCL_SHLIB_LD_EXTRAS='-compatibility_version ${VERSION} -current_version ${VERSION} -install_name ${DYLIB_INSTALL_DIR}/${TCL_LIB_FILE} -seg1addr 0xa000000'
 	    TK_SHLIB_LD_EXTRAS=' -compatibility_version ${VERSION} -current_version ${VERSION} -install_name ${DYLIB_INSTALL_DIR}/${TK_LIB_FILE}  -seg1addr 0xb000000 -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp $(TCL_BIN_DIR)/$(TCL_STUB_LIB_FILE) | tail +3 > $$f && echo $$f)'
-	    LIBS="$LIBS -framework CoreFoundation"
-	    cat >> confdefs.h <<\EOF
-#define MAC_OSX_TCL 1
+            echo $ac_n "checking whether to use CoreFoundation""... $ac_c" 1>&6
+echo "configure:2808: checking whether to use CoreFoundation" >&5
+            # Check whether --enable-corefoundation or --disable-corefoundation was given.
+if test "${enable_corefoundation+set}" = set; then
+  enableval="$enable_corefoundation"
+  tcl_corefoundation=$enableval
+else
+  tcl_corefoundation=yes
+fi
+
+            echo "$ac_t""$tcl_corefoundation" 1>&6
+            if test $tcl_corefoundation = yes; then
+                echo $ac_n "checking for CoreFoundation.framework""... $ac_c" 1>&6
+echo "configure:2820: checking for CoreFoundation.framework" >&5
+if eval "test \"`echo '$''{'tcl_cv_lib_corefoundation'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+                    hold_libs=$LIBS
+                    LIBS="$LIBS -framework CoreFoundation"
+                    cat > conftest.$ac_ext <<EOF
+#line 2828 "configure"
+#include "confdefs.h"
+#include <CoreFoundation/CoreFoundation.h>
+int main() {
+CFBundleRef b = CFBundleGetMainBundle();
+; return 0; }
+EOF
+if { (eval echo configure:2835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  tcl_cv_lib_corefoundation=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  tcl_cv_lib_corefoundation=no
+fi
+rm -f conftest*
+                    LIBS=$hold_libs
+fi
+
+echo "$ac_t""$tcl_cv_lib_corefoundation" 1>&6
+                if test $tcl_cv_lib_corefoundation = yes; then
+                    LIBS="$LIBS -framework CoreFoundation"
+                    cat >> confdefs.h <<\EOF
+#define HAVE_COREFOUNDATION 1
+EOF
+
+                fi
+	    fi
+	    for ac_hdr in libkern/OSAtomic.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2861: 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 2866 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2871: \"$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
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
 EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+	    for ac_func in OSSpinLockLock
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2900: 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 2905 "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:2928: \"$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
 
 	    cat >> confdefs.h <<\EOF
-#define HAVE_CFBUNDLE 1
+#define MAC_OSX_TCL 1
 EOF
 
 	    cat >> confdefs.h <<\EOF
@@ -2818,6 +2960,60 @@ EOF
 #define TCL_DEFAULT_ENCODING "utf-8"
 EOF
 
+	    # prior to Darwin 7, realpath is not threadsafe, so don't
+	    # use it when threads are enabled, c.f. bug # 711232:
+	    echo $ac_n "checking for realpath""... $ac_c" 1>&6
+echo "configure:2967: checking for realpath" >&5
+if eval "test \"`echo '$''{'ac_cv_func_realpath'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2972 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char realpath(); 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 realpath();
+
+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_realpath) || defined (__stub___realpath)
+choke me
+#else
+realpath();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_realpath=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_realpath=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'realpath`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+	    if test "$ac_cv_func_realpath" = yes -a "${TCL_THREADS}" = 1 \
+	            -a `uname -r | awk -F. '{print $1}'` -lt 7 ; then
+	        ac_cv_func_realpath=no
+	    fi
 	    ;;
 	NEXTSTEP-*)
 	    SHLIB_CFLAGS=""
@@ -3106,17 +3302,17 @@ EOF
 	    # 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:3110: checking for ld accepts -Bexport flag" >&5
+echo "configure:3306: checking for ld accepts -Bexport flag" >&5
 	    LDFLAGS="$LDFLAGS -Wl,-Bexport"
 	    cat > conftest.$ac_ext <<EOF
-#line 3113 "configure"
+#line 3309 "configure"
 #include "confdefs.h"
 
 int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:3120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   found=yes
 else
@@ -3157,9 +3353,9 @@ rm -f conftest*
 
     if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
 	echo $ac_n "checking sys/exec.h""... $ac_c" 1>&6
-echo "configure:3161: checking sys/exec.h" >&5
+echo "configure:3357: checking sys/exec.h" >&5
 	cat > conftest.$ac_ext <<EOF
-#line 3163 "configure"
+#line 3359 "configure"
 #include "confdefs.h"
 #include <sys/exec.h>
 int main() {
@@ -3177,7 +3373,7 @@ int main() {
     
 ; return 0; }
 EOF
-if { (eval echo configure:3181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3377: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_ok=usable
 else
@@ -3195,9 +3391,9 @@ EOF
 
 	else
 	    echo $ac_n "checking a.out.h""... $ac_c" 1>&6
-echo "configure:3199: checking a.out.h" >&5
+echo "configure:3395: checking a.out.h" >&5
 	    cat > conftest.$ac_ext <<EOF
-#line 3201 "configure"
+#line 3397 "configure"
 #include "confdefs.h"
 #include <a.out.h>
 int main() {
@@ -3215,7 +3411,7 @@ int main() {
 	    
 ; return 0; }
 EOF
-if { (eval echo configure:3219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3415: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_ok=usable
 else
@@ -3233,9 +3429,9 @@ EOF
 
 	    else
 		echo $ac_n "checking sys/exec_aout.h""... $ac_c" 1>&6
-echo "configure:3237: checking sys/exec_aout.h" >&5
+echo "configure:3433: checking sys/exec_aout.h" >&5
 		cat > conftest.$ac_ext <<EOF
-#line 3239 "configure"
+#line 3435 "configure"
 #include "confdefs.h"
 #include <sys/exec_aout.h>
 int main() {
@@ -3253,7 +3449,7 @@ int main() {
 		
 ; return 0; }
 EOF
-if { (eval echo configure:3257: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_ok=usable
 else
@@ -3404,7 +3600,7 @@ fi
 
 
     echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
-echo "configure:3408: checking for build with symbols" >&5
+echo "configure:3604: 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"
@@ -3465,21 +3661,21 @@ TK_DBGX=${DBGX}
 
 
     echo $ac_n "checking for required early compiler flags""... $ac_c" 1>&6
-echo "configure:3469: checking for required early compiler flags" >&5
+echo "configure:3665: checking for required early compiler flags" >&5
     tcl_flags=""
     
     if eval "test \"`echo '$''{'tcl_cv_flag__isoc99_source'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3476 "configure"
+#line 3672 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 int main() {
 char *p = (char *)strtoll; char *q = (char *)strtoull;
 ; return 0; }
 EOF
-if { (eval echo configure:3483: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_cv_flag__isoc99_source=no
 else
@@ -3487,7 +3683,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 3491 "configure"
+#line 3687 "configure"
 #include "confdefs.h"
 #define _ISOC99_SOURCE 1
 #include <stdlib.h>
@@ -3495,7 +3691,7 @@ int main() {
 char *p = (char *)strtoll; char *q = (char *)strtoull;
 ; return 0; }
 EOF
-if { (eval echo configure:3499: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3695: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_cv_flag__isoc99_source=yes
 else
@@ -3521,14 +3717,14 @@ EOF
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3525 "configure"
+#line 3721 "configure"
 #include "confdefs.h"
 #include <sys/stat.h>
 int main() {
 struct stat64 buf; int i = stat64("/", &buf);
 ; return 0; }
 EOF
-if { (eval echo configure:3532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_cv_flag__largefile64_source=no
 else
@@ -3536,7 +3732,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 3540 "configure"
+#line 3736 "configure"
 #include "confdefs.h"
 #define _LARGEFILE64_SOURCE 1
 #include <sys/stat.h>
@@ -3544,7 +3740,7 @@ int main() {
 struct stat64 buf; int i = stat64("/", &buf);
 ; return 0; }
 EOF
-if { (eval echo configure:3548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3744: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_cv_flag__largefile64_source=yes
 else
@@ -3573,7 +3769,7 @@ EOF
 
 
     echo $ac_n "checking for 64-bit integer type""... $ac_c" 1>&6
-echo "configure:3577: checking for 64-bit integer type" >&5
+echo "configure:3773: checking for 64-bit integer type" >&5
     if eval "test \"`echo '$''{'tcl_cv_type_64bit'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3581,14 +3777,14 @@ else
 	tcl_cv_type_64bit=none
 	# See if the compiler knows natively about __int64
 	cat > conftest.$ac_ext <<EOF
-#line 3585 "configure"
+#line 3781 "configure"
 #include "confdefs.h"
 
 int main() {
 __int64 value = (__int64) 0;
 ; return 0; }
 EOF
-if { (eval echo configure:3592: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_type_64bit=__int64
 else
@@ -3602,7 +3798,7 @@ rm -f conftest*
 	# type that is our current guess for a 64-bit type inside this check
 	# program, so it should be modified only carefully...
         cat > conftest.$ac_ext <<EOF
-#line 3606 "configure"
+#line 3802 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3611,7 +3807,7 @@ switch (0) { 
         }
 ; return 0; }
 EOF
-if { (eval echo configure:3615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_cv_type_64bit=${tcl_type_64bit}
 else
@@ -3636,13 +3832,13 @@ EOF
 
 	# Now check for auxiliary declarations
 	echo $ac_n "checking for struct dirent64""... $ac_c" 1>&6
-echo "configure:3640: checking for struct dirent64" >&5
+echo "configure:3836: checking for struct dirent64" >&5
 	if eval "test \"`echo '$''{'tcl_cv_struct_dirent64'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	    cat > conftest.$ac_ext <<EOF
-#line 3646 "configure"
+#line 3842 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/dirent.h>
@@ -3650,7 +3846,7 @@ int main() {
 struct dirent64 p;
 ; return 0; }
 EOF
-if { (eval echo configure:3654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3850: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_cv_struct_dirent64=yes
 else
@@ -3671,13 +3867,13 @@ EOF
 	echo "$ac_t""${tcl_cv_struct_dirent64}" 1>&6
 
 	echo $ac_n "checking for struct stat64""... $ac_c" 1>&6
-echo "configure:3675: checking for struct stat64" >&5
+echo "configure:3871: checking for struct stat64" >&5
 	if eval "test \"`echo '$''{'tcl_cv_struct_stat64'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	    cat > conftest.$ac_ext <<EOF
-#line 3681 "configure"
+#line 3877 "configure"
 #include "confdefs.h"
 #include <sys/stat.h>
 int main() {
@@ -3685,7 +3881,7 @@ struct stat64 p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:3689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3885: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_cv_struct_stat64=yes
 else
@@ -3708,12 +3904,12 @@ EOF
 	for ac_func in open64 lseek64
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3712: checking for $ac_func" >&5
+echo "configure:3908: 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 3717 "configure"
+#line 3913 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3736,7 +3932,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3936: \"$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
@@ -3761,13 +3957,13 @@ fi
 done
 
 	echo $ac_n "checking for off64_t""... $ac_c" 1>&6
-echo "configure:3765: checking for off64_t" >&5
+echo "configure:3961: checking for off64_t" >&5
 	if eval "test \"`echo '$''{'tcl_cv_type_off64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	    cat > conftest.$ac_ext <<EOF
-#line 3771 "configure"
+#line 3967 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
@@ -3775,7 +3971,7 @@ off64_t offset;
 
 ; return 0; }
 EOF
-if { (eval echo configure:3779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tcl_cv_type_off64_t=yes
 else
@@ -3805,14 +4001,14 @@ EOF
 #--------------------------------------------------------------------
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3809: checking whether byte ordering is bigendian" >&5
+echo "configure:4005: checking whether byte ordering is bigendian" >&5
 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 3816 "configure"
+#line 4012 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3823,11 +4019,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4023: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 3831 "configure"
+#line 4027 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3838,7 +4034,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -3858,7 +4054,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 3862 "configure"
+#line 4058 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -3871,7 +4067,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:3875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -3921,12 +4117,12 @@ fi
 
 MATH_LIBS=""
 echo $ac_n "checking for sin""... $ac_c" 1>&6
-echo "configure:3925: checking for sin" >&5
+echo "configure:4121: 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 3930 "configure"
+#line 4126 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char sin(); below.  */
@@ -3949,7 +4145,7 @@ sin();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4149: \"$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
@@ -3970,7 +4166,7 @@ MATH_LIBS="-lm"
 fi
 
 echo $ac_n "checking for main in -lieee""... $ac_c" 1>&6
-echo "configure:3974: checking for main in -lieee" >&5
+echo "configure:4170: 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
@@ -3978,14 +4174,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lieee  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3982 "configure"
+#line 4178 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:3989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4185: \"$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
@@ -4016,7 +4212,7 @@ fi
 libbsd=no
 if test "`uname -s`" = "AIX" ; then
     echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6
-echo "configure:4020: checking for gettimeofday in -lbsd" >&5
+echo "configure:4216: 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
@@ -4024,7 +4220,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4028 "configure"
+#line 4224 "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
@@ -4035,7 +4231,7 @@ int main() {
 gettimeofday()
 ; return 0; }
 EOF
-if { (eval echo configure:4039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4235: \"$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
@@ -4066,9 +4262,9 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking stdlib.h""... $ac_c" 1>&6
-echo "configure:4070: checking stdlib.h" >&5
+echo "configure:4266: checking stdlib.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4072 "configure"
+#line 4268 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -4083,7 +4279,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 4087 "configure"
+#line 4283 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -4097,7 +4293,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 4101 "configure"
+#line 4297 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -4129,16 +4325,16 @@ echo "$ac_t""$tk_ok" 1>&6
 #--------------------------------------------------------------------
 
 echo $ac_n "checking fd_set and sys/select""... $ac_c" 1>&6
-echo "configure:4133: checking fd_set and sys/select" >&5
+echo "configure:4329: checking fd_set and sys/select" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4135 "configure"
+#line 4331 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
 fd_set readMask, writeMask;
 ; return 0; }
 EOF
-if { (eval echo configure:4142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4338: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tk_ok=yes
 else
@@ -4150,7 +4346,7 @@ fi
 rm -f conftest*
 if test $tk_ok = no; then
     cat > conftest.$ac_ext <<EOF
-#line 4154 "configure"
+#line 4350 "configure"
 #include "confdefs.h"
 #include <sys/select.h>
 EOF
@@ -4182,12 +4378,12 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4186: checking for ANSI C header files" >&5
+echo "configure:4382: 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 4191 "configure"
+#line 4387 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -4195,7 +4391,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4199: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4395: \"$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*
@@ -4212,7 +4408,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 4216 "configure"
+#line 4412 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -4230,7 +4426,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 4234 "configure"
+#line 4430 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -4251,7 +4447,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 4255 "configure"
+#line 4451 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -4262,7 +4458,7 @@ if (XOR (islower (i), ISLOWER (i)) || to
 exit (0); }
 
 EOF
-if { (eval echo configure:4266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -4286,12 +4482,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:4290: checking for mode_t" >&5
+echo "configure:4486: 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 4295 "configure"
+#line 4491 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4319,12 +4515,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:4323: checking for pid_t" >&5
+echo "configure:4519: 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 4328 "configure"
+#line 4524 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4352,12 +4548,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:4356: checking for size_t" >&5
+echo "configure:4552: 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 4361 "configure"
+#line 4557 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4385,12 +4581,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:4389: checking for uid_t in sys/types.h" >&5
+echo "configure:4585: 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 4394 "configure"
+#line 4590 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -4427,17 +4623,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:4431: checking for $ac_hdr" >&5
+echo "configure:4627: 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 4436 "configure"
+#line 4632 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4441: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4637: \"$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*
@@ -4464,12 +4660,12 @@ fi
 done
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:4468: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:4664: 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 4473 "configure"
+#line 4669 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -4478,7 +4674,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:4482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4678: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -4504,16 +4700,16 @@ fi
 #-------------------------------------------
 
 echo $ac_n "checking pw_gecos in struct pwd""... $ac_c" 1>&6
-echo "configure:4508: checking pw_gecos in struct pwd" >&5
+echo "configure:4704: checking pw_gecos in struct pwd" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4510 "configure"
+#line 4706 "configure"
 #include "confdefs.h"
 #include <pwd.h>
 int main() {
 struct passwd pwd; pwd.pw_gecos;
 ; return 0; }
 EOF
-if { (eval echo configure:4517: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4713: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   tk_ok=yes
 else
@@ -4546,7 +4742,7 @@ fi
 # 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:4550: checking for X" >&5
+echo "configure:4746: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -4608,12 +4804,12 @@ if test "$ac_x_includes" = NO; then
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 4612 "configure"
+#line 4808 "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:4617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4813: \"$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*
@@ -4682,14 +4878,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 4686 "configure"
+#line 4882 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:4693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4889: \"$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.
@@ -4779,12 +4975,12 @@ fi
     if test "$no_x" = ""; then
 	if test "$x_includes" = ""; then
 	    cat > conftest.$ac_ext <<EOF
-#line 4783 "configure"
+#line 4979 "configure"
 #include "confdefs.h"
 #include <X11/XIntrinsic.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4788: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4984: \"$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
   :
@@ -4804,15 +5000,15 @@ rm -f conftest*
     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:4808: checking for X11 header files" >&5
+echo "configure:5004: checking for X11 header files" >&5
 	found_xincludes="no"
 	cat > conftest.$ac_ext <<EOF
-#line 4811 "configure"
+#line 5007 "configure"
 #include "confdefs.h"
 #include <X11/Intrinsic.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5012: \"$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*
@@ -4848,7 +5044,7 @@ rm -f conftest*
 
     if test "$no_x" = yes; then
 	echo $ac_n "checking for X11 libraries""... $ac_c" 1>&6
-echo "configure:4852: checking for X11 libraries" >&5
+echo "configure:5048: 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
@@ -4868,7 +5064,7 @@ echo "configure:4852: checking for X11 l
     fi
     if test "$XLIBSW" = nope ; then
 	echo $ac_n "checking for XCreateWindow in -lXwindow""... $ac_c" 1>&6
-echo "configure:4872: checking for XCreateWindow in -lXwindow" >&5
+echo "configure:5068: 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
@@ -4876,7 +5072,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXwindow  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4880 "configure"
+#line 5076 "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
@@ -4887,7 +5083,7 @@ int main() {
 XCreateWindow()
 ; return 0; }
 EOF
-if { (eval echo configure:4891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5087: \"$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
@@ -4961,7 +5157,7 @@ eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_F
 #--------------------------------------------------------------------
 
 echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6
-echo "configure:4965: checking for main in -lXbsd" >&5
+echo "configure:5161: 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
@@ -4969,14 +5165,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4973 "configure"
+#line 5169 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5176: \"$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
@@ -4999,12 +5195,12 @@ fi
 
 tk_checkBoth=0
 echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:5003: checking for connect" >&5
+echo "configure:5199: 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 5008 "configure"
+#line 5204 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -5027,7 +5223,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5227: \"$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
@@ -5049,7 +5245,7 @@ fi
 
 if test "$tk_checkSocket" = 1; then
     echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:5053: checking for main in -lsocket" >&5
+echo "configure:5249: 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
@@ -5057,14 +5253,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5061 "configure"
+#line 5257 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5264: \"$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
@@ -5090,12 +5286,12 @@ if test "$tk_checkBoth" = 1; then
     tk_oldLibs=$LIBS
     LIBS="$LIBS -lsocket -lnsl"
     echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:5094: checking for accept" >&5
+echo "configure:5290: 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 5099 "configure"
+#line 5295 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char accept(); below.  */
@@ -5118,7 +5314,7 @@ accept();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5318: \"$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
@@ -5140,12 +5336,12 @@ fi
 
 fi
 echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:5144: checking for gethostbyname" >&5
+echo "configure:5340: 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 5149 "configure"
+#line 5345 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -5168,7 +5364,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5368: \"$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
@@ -5186,7 +5382,7 @@ if eval "test \"`echo '$ac_cv_func_'geth
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:5190: checking for main in -lnsl" >&5
+echo "configure:5386: 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
@@ -5194,14 +5390,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5198 "configure"
+#line 5394 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5401: \"$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
@@ -5237,13 +5433,13 @@ fi
 
 if test -d /usr/include/mit ; then
     echo $ac_n "checking MIT X libraries""... $ac_c" 1>&6
-echo "configure:5241: checking MIT X libraries" >&5
+echo "configure:5437: 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 5247 "configure"
+#line 5443 "configure"
 #include "confdefs.h"
 
 	#include <X11/Xlib.h>
@@ -5254,7 +5450,7 @@ int main() {
     
 ; return 0; }
 EOF
-if { (eval echo configure:5258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   
 	echo "$ac_t""yes" 1>&6
@@ -5278,14 +5474,14 @@ fi
 #--------------------------------------------------------------------
 
 echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:5282: checking whether char is unsigned" >&5
+echo "configure:5478: 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 5289 "configure"
+#line 5485 "configure"
 #include "confdefs.h"
 #ifdef __CHAR_UNSIGNED__
   yes
@@ -5307,7 +5503,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 5311 "configure"
+#line 5507 "configure"
 #include "confdefs.h"
 /* volatile prevents gcc2 from optimizing the test away on sparcs.  */
 #if !defined(__STDC__) || __STDC__ != 1
@@ -5317,7 +5513,7 @@ main() {
   volatile char c = 255; exit(c < 0);
 }
 EOF
-if { (eval echo configure:5321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5517: \"$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
@@ -5350,12 +5546,12 @@ fi
 
 
     echo $ac_n "checking for strtod""... $ac_c" 1>&6
-echo "configure:5354: checking for strtod" >&5
+echo "configure:5550: 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 5359 "configure"
+#line 5555 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strtod(); below.  */
@@ -5378,7 +5574,7 @@ strtod();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5578: \"$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
@@ -5400,7 +5596,7 @@ fi
 
     if test "$tcl_strtod" = 1; then
 	echo $ac_n "checking for Solaris2.4/Tru64 strtod bugs""... $ac_c" 1>&6
-echo "configure:5404: checking for Solaris2.4/Tru64 strtod bugs" >&5
+echo "configure:5600: checking for Solaris2.4/Tru64 strtod bugs" >&5
 	if eval "test \"`echo '$''{'tcl_cv_strtod_buggy'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5409,7 +5605,7 @@ else
   tcl_cv_strtod_buggy=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 5413 "configure"
+#line 5609 "configure"
 #include "confdefs.h"
 
 		extern double strtod();
@@ -5432,7 +5628,7 @@ else
 		    exit(0);
 		}
 EOF
-if { (eval echo configure:5436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   tcl_cv_strtod_buggy=1
 else
Index: unix/tcl.m4
===================================================================
RCS file: /cvsroot/tktoolkit/tk/unix/tcl.m4,v
retrieving revision 1.51.2.17
diff -u -p -u -p -r1.51.2.17 tcl.m4
--- unix/tcl.m4	7 May 2005 00:03:05 -0000	1.51.2.17
+++ unix/tcl.m4	14 May 2005 19:16:14 -0000
@@ -387,6 +387,10 @@ AC_DEFUN(SC_ENABLE_FRAMEWORK, [
 	    AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes")
 	    FRAMEWORK_BUILD=0
 	fi
+	if test $tcl_corefoundation = no; then
+	    AC_MSG_WARN("Frameworks can only be used when CoreFoundation is available")
+	    FRAMEWORK_BUILD=0
+	fi
     else
 	AC_MSG_RESULT([standard shared library])
 	FRAMEWORK_BUILD=0
@@ -1389,11 +1393,35 @@ dnl AC_CHECK_TOOL(AR, ar)
 	    PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
 	    TCL_SHLIB_LD_EXTRAS='-compatibility_version ${VERSION} -current_version ${VERSION} -install_name ${DYLIB_INSTALL_DIR}/${TCL_LIB_FILE} -seg1addr 0xa000000'
 	    TK_SHLIB_LD_EXTRAS=' -compatibility_version ${VERSION} -current_version ${VERSION} -install_name ${DYLIB_INSTALL_DIR}/${TK_LIB_FILE}  -seg1addr 0xb000000 -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp $(TCL_BIN_DIR)/$(TCL_STUB_LIB_FILE) | tail +3 > $$f && echo $$f)'
-	    LIBS="$LIBS -framework CoreFoundation"
+            AC_MSG_CHECKING([whether to use CoreFoundation])
+            AC_ARG_ENABLE(corefoundation, [  --enable-corefoundation use CoreFoundation API [--enable-corefoundation]],
+                [tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
+            AC_MSG_RESULT([$tcl_corefoundation])
+            if test $tcl_corefoundation = yes; then
+                AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [
+                    hold_libs=$LIBS
+                    LIBS="$LIBS -framework CoreFoundation"
+                    AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>], 
+                        [CFBundleRef b = CFBundleGetMainBundle();], 
+                        tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no)
+                    LIBS=$hold_libs])
+                if test $tcl_cv_lib_corefoundation = yes; then
+                    LIBS="$LIBS -framework CoreFoundation"
+                    AC_DEFINE(HAVE_COREFOUNDATION)
+                fi
+	    fi
+	    AC_CHECK_HEADERS(libkern/OSAtomic.h)
+	    AC_CHECK_FUNCS(OSSpinLockLock)
 	    AC_DEFINE(MAC_OSX_TCL)
-	    AC_DEFINE(HAVE_CFBUNDLE)
 	    AC_DEFINE(USE_VFORK)
 	    AC_DEFINE(TCL_DEFAULT_ENCODING,"utf-8")
+	    # prior to Darwin 7, realpath is not threadsafe, so don't
+	    # use it when threads are enabled, c.f. bug # 711232:
+	    AC_CHECK_FUNC(realpath)
+	    if test "$ac_cv_func_realpath" = yes -a "${TCL_THREADS}" = 1 \
+	            -a `uname -r | awk -F. '{print [$]1}'` -lt 7 ; then
+	        ac_cv_func_realpath=no
+	    fi
 	    ;;
 	NEXTSTEP-*)
 	    SHLIB_CFLAGS=""
