summaryrefslogtreecommitdiffstats
path: root/generic/tkPkgConfig.c
diff options
context:
space:
mode:
authorstu <stwo@users.sourceforge.net>2017-05-20 11:47:46 (GMT)
committerstu <stwo@users.sourceforge.net>2017-05-20 11:47:46 (GMT)
commit2afd7451e708c09b61ba7820e627a2d6fbecb3fb (patch)
tree37e2fb2c7bf2677ee7a88230996bc9d70627cbad /generic/tkPkgConfig.c
parent2f6784b43da06329dbec3b7f0442161a0d748ffb (diff)
downloadtk-2afd7451e708c09b61ba7820e627a2d6fbecb3fb.zip
tk-2afd7451e708c09b61ba7820e627a2d6fbecb3fb.tar.gz
tk-2afd7451e708c09b61ba7820e627a2d6fbecb3fb.tar.bz2
Bring more TIP #59 to Tk.<br>
Move ::tk::pkgconfig setup code from unix/tkUnixRFont.c to new file generic/tkPkgConfig.c.<br> Copied Tcl/tests/config.test into new file Tk/tests/pkgconfig.test. I believe the name 'pkgconfig.test' is better.<br> Adjust build system to accommodate.<br> Use value 'x11' for when fontsystem 'xft' unavailable.<br>
Diffstat (limited to 'generic/tkPkgConfig.c')
-rw-r--r--generic/tkPkgConfig.c150
1 files changed, 150 insertions, 0 deletions
diff --git a/generic/tkPkgConfig.c b/generic/tkPkgConfig.c
new file mode 100644
index 0000000..d913fb1
--- /dev/null
+++ b/generic/tkPkgConfig.c
@@ -0,0 +1,150 @@
+/*
+ * tkPkgConfig.c --
+ *
+ * This file contains the configuration information to embed into the tcl
+ * binary library.
+ *
+ * Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+/* Note, the definitions in this module are influenced by the following C
+ * preprocessor macros:
+ *
+ * OSCMa = shortcut for "old style configuration macro activates"
+ * NSCMdt = shortcut for "new style configuration macro declares that"
+ *
+ * - TCL_THREADS OSCMa compilation as threaded core.
+ * - TCL_MEM_DEBUG OSCMa memory debugging.
+ * - TCL_COMPILE_DEBUG OSCMa debugging of bytecode compiler.
+ * - TCL_COMPILE_STATS OSCMa bytecode compiler statistics.
+ *
+ * - TCL_CFG_DO64BIT NSCMdt tk is compiled for a 64bit system.
+ * - NDEBUG NSCMdt tk is compiled with symbol info off.
+ * - TCL_CFG_OPTIMIZED NSCMdt tk is compiled with cc optimizations on
+ * - TCL_CFG_PROFILED NSCMdt tk is compiled with profiling info.
+ * - HAVE_XFT NSCMdt tk is compiled with xft font support.
+ *
+ * - CFG_RUNTIME_* Paths to various stuff at runtime.
+ * - CFG_INSTALL_* Paths to various stuff at installation time.
+ *
+ * - TCL_CFGVAL_ENCODING string containing the encoding used for the
+ * configuration values.
+ */
+
+#include "tkInt.h"
+
+
+#ifndef TCL_CFGVAL_ENCODING
+#define TCL_CFGVAL_ENCODING "ascii"
+#endif
+
+/*
+ * Use C preprocessor statements to define the various values for the embedded
+ * configuration information.
+ */
+
+#ifdef TCL_THREADS
+# define CFG_THREADED "1"
+#else
+# define CFG_THREADED "0"
+#endif
+
+#ifdef TCL_MEM_DEBUG
+# define CFG_MEMDEBUG "1"
+#else
+# define CFG_MEMDEBUG "0"
+#endif
+
+#ifdef TCL_COMPILE_DEBUG
+# define CFG_COMPILE_DEBUG "1"
+#else
+# define CFG_COMPILE_DEBUG "0"
+#endif
+
+#ifdef TCL_COMPILE_STATS
+# define CFG_COMPILE_STATS "1"
+#else
+# define CFG_COMPILE_STATS "0"
+#endif
+
+#ifdef TCL_CFG_DO64BIT
+# define CFG_64 "1"
+#else
+# define CFG_64 "0"
+#endif
+
+#ifndef NDEBUG
+# define CFG_DEBUG "1"
+#else
+# define CFG_DEBUG "0"
+#endif
+
+#ifdef TCL_CFG_OPTIMIZED
+# define CFG_OPTIMIZED "1"
+#else
+# define CFG_OPTIMIZED "0"
+#endif
+
+#ifdef TCL_CFG_PROFILED
+# define CFG_PROFILED "1"
+#else
+# define CFG_PROFILED "0"
+#endif
+
+#ifdef HAVE_XFT
+# define CFG_FONTSYSTEM "xft"
+#else
+# define CFG_FONTSYSTEM "x11"
+#endif
+
+static Tcl_Config const cfg[] = {
+ {"debug", CFG_DEBUG},
+ {"threaded", CFG_THREADED},
+ {"profiled", CFG_PROFILED},
+ {"64bit", CFG_64},
+ {"optimized", CFG_OPTIMIZED},
+ {"mem_debug", CFG_MEMDEBUG},
+ {"compile_debug", CFG_COMPILE_DEBUG},
+ {"compile_stats", CFG_COMPILE_STATS},
+ {"fontsystem", CFG_FONTSYSTEM},
+
+ /* Runtime paths to various stuff */
+
+ {"libdir,runtime", CFG_RUNTIME_LIBDIR},
+ {"bindir,runtime", CFG_RUNTIME_BINDIR},
+ {"scriptdir,runtime", CFG_RUNTIME_SCRDIR},
+ {"includedir,runtime", CFG_RUNTIME_INCDIR},
+ {"docdir,runtime", CFG_RUNTIME_DOCDIR},
+ {"demodir,runtime", CFG_RUNTIME_DEMODIR},
+
+ /* Installation paths to various stuff */
+
+ {"libdir,install", CFG_INSTALL_LIBDIR},
+ {"bindir,install", CFG_INSTALL_BINDIR},
+ {"scriptdir,install", CFG_INSTALL_SCRDIR},
+ {"includedir,install", CFG_INSTALL_INCDIR},
+ {"docdir,install", CFG_INSTALL_DOCDIR},
+ {"demodir,install", CFG_INSTALL_DEMODIR},
+
+ /* Last entry, closes the array */
+ {NULL, NULL}
+};
+
+void
+TkInitEmbeddedConfigurationInformation(
+ Tcl_Interp *interp) /* Interpreter the configuration command is
+ * registered in. */
+{
+ Tcl_RegisterConfig(interp, "tk", cfg, TCL_CFGVAL_ENCODING);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */