summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixInit.c
diff options
context:
space:
mode:
authordas <das>2005-05-23 20:24:56 (GMT)
committerdas <das>2005-05-23 20:24:56 (GMT)
commitb1aaa8a9641695afda195f1e3450c10a4de59670 (patch)
tree6a75bc6224147be902b9f8707503d0ea3eebc0a9 /unix/tkUnixInit.c
parent3e5059b18e124abb2aacc381e3e3c8c2e95c23c3 (diff)
downloadtk-b1aaa8a9641695afda195f1e3450c10a4de59670.zip
tk-b1aaa8a9641695afda195f1e3450c10a4de59670.tar.gz
tk-b1aaa8a9641695afda195f1e3450c10a4de59670.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.59 * unix/tkConfig.h.in (new file): autoheader-2.59
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..05dcc49 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.6 2005/05/23 20:25:04 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 */