From 7614214a0526527a62f6cc88b6560f003397c1a3 Mon Sep 17 00:00:00 2001 From: das Date: Wed, 7 Mar 2007 23:48:08 +0000 Subject: * generic/tkMain.c (Tk_MainEx): replicate macosx-specific code from TkpInit() that ensures the console window appears when wish is started from the OS X Finder (i.e. with stdin == /dev/null), jeffh's 2006-11-24 change rendered the corresponding code in TkpInit() ineffective in wish because Tk_MainEx() sets tcl_interactive before calling TkpInit(). * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol): add fix for libraries loaded with a DYLD_IMAGE_SUFFIX. * unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check. * unix/configure: autoconf-2.13 --- ChangeLog | 14 ++++++++++++++ generic/tkMain.c | 23 ++++++++++++++++++----- macosx/tkMacOSXDebug.c | 10 +++++++--- unix/configure | 2 +- unix/tcl.m4 | 2 +- 5 files changed, 41 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e11dbe..735a4b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2007-03-07 Daniel Steffen + + * generic/tkMain.c (Tk_MainEx): replicate macosx-specific code from + TkpInit() that ensures the console window appears when wish is started + from the OS X Finder (i.e. with stdin == /dev/null), jeffh's 2006-11-24 + change rendered the corresponding code in TkpInit() ineffective in wish + because Tk_MainEx() sets tcl_interactive before calling TkpInit(). + + * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol): add fix for + libraries loaded with a DYLD_IMAGE_SUFFIX. + + * unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check. + * unix/configure: autoconf-2.13 + 2007-02-19 Jeff Hobbs * unix/tcl.m4: use SHLIB_SUFFIX=".so" on HP-UX ia64 arch. diff --git a/generic/tkMain.c b/generic/tkMain.c index 0e87228..41603d7 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMain.c,v 1.15.2.5 2006/09/25 17:28:20 andreas_kupries Exp $ + * RCS: @(#) $Id: tkMain.c,v 1.15.2.6 2007/03/07 23:48:13 das Exp $ */ #include @@ -103,7 +103,7 @@ Tk_MainEx(argc, argv, appInitProc, interp) Tcl_Interp *interp; { Tcl_Obj *argvPtr; - int code; + int code, nullStdin = 0; size_t length; Tcl_Channel inChannel, outChannel; Tcl_DString appName; @@ -196,6 +196,7 @@ Tk_MainEx(argc, argv, appInitProc, interp) * Set the "tcl_interactive" variable. */ +#ifdef __WIN32__ /* * For now, under Windows, we assume we are not running as a console mode * app, so we need to use the GUI console. In order to enable this, we @@ -203,7 +204,6 @@ Tk_MainEx(argc, argv, appInitProc, interp) * way to do it. */ -#ifdef __WIN32__ handle = GetStdHandle(STD_INPUT_HANDLE); if ((handle == INVALID_HANDLE_VALUE) || (handle == 0) @@ -227,9 +227,22 @@ Tk_MainEx(argc, argv, appInitProc, interp) #else tsdPtr->tty = isatty(0); #endif +#if defined(MAC_OSX_TK) + /* + * On TkAqua, if we don't have a TTY and stdin is a special character file + * of length 0, (e.g. /dev/null, which is what Finder sets when double + * clicking Wish) then use the GUI console. + */ + + if (!tsdPtr->tty) { + struct stat st; + + nullStdin = fstat(0, &st) || (S_ISCHR(st.st_mode) && !st.st_blocks); + } +#endif Tcl_SetVar(interp, "tcl_interactive", - ((TclGetStartupScriptFileName() == NULL) - && tsdPtr->tty) ? "1" : "0", TCL_GLOBAL_ONLY); + ((TclGetStartupScriptFileName() == NULL) && (tsdPtr->tty + || nullStdin)) ? "1" : "0", TCL_GLOBAL_ONLY); /* * Invoke application-specific initialization. diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c index 02c51a9..a0e1fe0 100644 --- a/macosx/tkMacOSXDebug.c +++ b/macosx/tkMacOSXDebug.c @@ -5,7 +5,7 @@ * regions, etc... * * Copyright 2001, Apple Computer, Inc. - * Copyright (c) 2006 Daniel A. Steffen + * Copyright (c) 2006-2007 Daniel A. Steffen * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -54,7 +54,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.2.2.9 2006/10/31 22:33:38 das Exp $ + * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.2.2.10 2007/03/07 23:48:13 das Exp $ */ #include "tkMacOSXInt.h" @@ -494,7 +494,11 @@ TkMacOSXGetNamedDebugSymbol(const char* module, const char* symbol) if (!addr) { const struct mach_header *mh = NULL; uint32_t i, n = _dyld_image_count(); + size_t module_len; + if (module && *module) { + module_len = strlen(module); + } for (i = 0; i < n; i++) { if (module && *module) { /* Find image with given module name */ @@ -505,7 +509,7 @@ TkMacOSXGetNamedDebugSymbol(const char* module, const char* symbol) continue; } name = strrchr(path, '/') + 1; - if (strncmp(name, module, strlen(name)) != 0) { + if (strncmp(name, module, module_len) != 0) { continue; } } diff --git a/unix/configure b/unix/configure index 966d7e6..773a949 100755 --- a/unix/configure +++ b/unix/configure @@ -3085,7 +3085,7 @@ echo "$ac_t""$tcl_cv_ld_single_module" 1>&6 DL_LIBS="" # Don't use -prebind when building for Mac OS X 10.4 or later only: test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \ - "`echo "${CFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4 && \ + "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4 && \ LDFLAGS="$LDFLAGS -prebind" LDFLAGS="$LDFLAGS -headerpad_max_install_names" echo $ac_n "checking if ld accepts -search_paths_first flag""... $ac_c" 1>&6 diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 24a0899..cf27917 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1622,7 +1622,7 @@ dnl AC_CHECK_TOOL(AR, ar) DL_LIBS="" # Don't use -prebind when building for Mac OS X 10.4 or later only: test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \ - "`echo "${CFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \ + "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \ LDFLAGS="$LDFLAGS -prebind" LDFLAGS="$LDFLAGS -headerpad_max_install_names" AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [ -- cgit v0.12