summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixInit.c
diff options
context:
space:
mode:
authordas <das>2005-05-24 04:21:31 (GMT)
committerdas <das>2005-05-24 04:21:31 (GMT)
commitb0fdc226a3f785fcf390544a5546be0cfd1e7458 (patch)
treeba20400bcdbf394be0258f6dc603b703b1a34d56 /unix/tkUnixInit.c
parent5be843b40e45bf4ee2b4cb252a4d877ed85b8563 (diff)
downloadtk-b0fdc226a3f785fcf390544a5546be0cfd1e7458.zip
tk-b0fdc226a3f785fcf390544a5546be0cfd1e7458.tar.gz
tk-b0fdc226a3f785fcf390544a5546be0cfd1e7458.tar.bz2
* macosx/Makefile:
* macosx/README: * macosx/Tk-Info.plist.in (new file): * macosx/Wish-Info.plist.in (new file): * unix/Makefile.in: * unix/configure.in: * unix/tcl.m4: * unix/tkUnixInit.c: moved all Darwin framework and TkAqua build support from macosx/Wish.pbproj and macosx/Makefile into the standard unix configure/make buildsystem, the project and macosx/Makefile are no longer required to build Tk.framework and/or TkAqua. TkAqua is now enabled by the --enable-aqua configure option, and static and non-framework builds of TkAqua are now available via the standard configure switches. Tk/X11 can also be built as a framework. The macosx/Makefile now wraps the unix buildsystem and no longer uses the projects, embedded builds are still only available via this Makefile, but for other builds it is not longer required (but its current functionality is still available for backwards compatibility). The projects currently do not call through to the Makefile to build (unlike Tcl.pbproj) so project builds may differ from makefile builds. Due to issues with spaces in pathnames, 'Wish Shell.app' has been renamed to 'Wish.app', the macosx/Makefile installs backwards compatibility symlinks for the old name. * macosx/tkMacOSXInit.c (TkpInit): added support for Tk resource file in non-framework and static builds: the resource file is copied into a __tk_rsrc MachO segment of the library or executable at link time and extracted into a temporary location at initialization. * unix/configure: autoconf-2.13
Diffstat (limited to 'unix/tkUnixInit.c')
-rw-r--r--unix/tkUnixInit.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c
index 825b0c1..2fae9cf 100644
--- a/unix/tkUnixInit.c
+++ b/unix/tkUnixInit.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixInit.c,v 1.5 2002/01/25 21:09:37 dgp Exp $
+ * RCS: @(#) $Id: tkUnixInit.c,v 1.5.2.1 2005/05/24 04:21:34 das Exp $
*/
#include "tkInt.h"
@@ -21,6 +21,11 @@
*/
#include "tkInitScript.h"
+#ifdef HAVE_COREFOUNDATION
+static int MacOSXGetLibraryPath _ANSI_ARGS_((
+ Tcl_Interp *interp));
+#endif /* HAVE_COREFOUNDATION */
+
/*
*----------------------------------------------------------------------
@@ -45,6 +50,9 @@ TkpInit(interp)
Tcl_Interp *interp;
{
TkCreateXEventSource();
+#ifdef HAVE_COREFOUNDATION
+ MacOSXGetLibraryPath(interp);
+#endif /* HAVE_COREFOUNDATION */
return Tcl_Eval(interp, initScript);
}
@@ -115,3 +123,38 @@ TkpDisplayWarning(msg, title)
Tcl_WriteChars(errChannel, "\n", 1);
}
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MacOSXGetLibraryPath --
+ *
+ * If we have a bundle structure for the Tk installation,
+ * then check there first to see if we can find the libraries
+ * there.
+ *
+ * Results:
+ * TCL_OK if we have found the tk library; TCL_ERROR otherwise.
+ *
+ * Side effects:
+ * Same as for Tcl_MacOSXOpenVersionedBundleResources.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#ifdef HAVE_COREFOUNDATION
+static int
+MacOSXGetLibraryPath(Tcl_Interp *interp)
+{
+ int foundInFramework = TCL_ERROR;
+#ifdef TK_FRAMEWORK
+ char tkLibPath[PATH_MAX + 1];
+ foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp,
+ "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX, tkLibPath);
+ if (tkLibPath[0] != '\0') {
+ Tcl_SetVar(interp, "tk_library", tkLibPath, TCL_GLOBAL_ONLY);
+ }
+#endif
+ return foundInFramework;
+}
+#endif /* HAVE_COREFOUNDATION */