summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2007-03-07 23:48:08 (GMT)
committerdas <das>2007-03-07 23:48:08 (GMT)
commit7614214a0526527a62f6cc88b6560f003397c1a3 (patch)
treebadb4612c17d0114c5c4597e380a51c05a0867ab
parent71343a18cb63f16e62500a7a3f17942ccd841684 (diff)
downloadtk-7614214a0526527a62f6cc88b6560f003397c1a3.zip
tk-7614214a0526527a62f6cc88b6560f003397c1a3.tar.gz
tk-7614214a0526527a62f6cc88b6560f003397c1a3.tar.bz2
* 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
-rw-r--r--ChangeLog14
-rw-r--r--generic/tkMain.c23
-rw-r--r--macosx/tkMacOSXDebug.c10
-rwxr-xr-xunix/configure2
-rw-r--r--unix/tcl.m42
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 <das@users.sourceforge.net>
+
+ * 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 <jeffh@ActiveState.com>
* 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 <ctype.h>
@@ -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 <das@users.sourceforge.net>
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
* 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, [