Debian Codegraph @

generic/tclPkgConfig.c

raw
1 /*
2 * tclPkgConfig.c --
3 *
4 * This file contains the configuration information to embed into the tcl
5 * library.
6 *
7 * Copyright (c) 2002 Andreas Kupries <[email protected]>
8 *
9 * See the file "license.terms" for information on usage and redistribution of
10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 */
12
13 /* Note, the definitions in this module are influenced by the following C
14 * preprocessor macros:
15 *
16 * OSCMa = shortcut for "old style configuration macro activates"
17 * NSCMdt = shortcut for "new style configuration macro declares that"
18 *
19 * - TCL_THREADS OSCMa compilation as threaded core.
20 * - TCL_MEM_DEBUG OSCMa memory debugging.
21 * - TCL_COMPILE_DEBUG OSCMa debugging of bytecode compiler.
22 * - TCL_COMPILE_STATS OSCMa bytecode compiler statistics.
23 *
24 * - TCL_CFG_DO64BIT NSCMdt tcl is compiled for a 64bit system.
25 * - NDEBUG NSCMdt tcl is compiled with symbol info off.
26 * - TCL_CFG_OPTIMIZED NSCMdt tcl is compiled with cc optimizations on
27 * - TCL_CFG_PROFILED NSCMdt tcl is compiled with profiling info.
28 *
29 * - CFG_RUNTIME_* Paths to various stuff at runtime.
30 * - CFG_INSTALL_* Paths to various stuff at installation time.
31 *
32 * - TCL_CFGVAL_ENCODING string containing the encoding used for the
33 * configuration values.
34 */
35
36 #include "tclInt.h"
37
38 #ifndef TCL_CFGVAL_ENCODING
39 # ifdef _WIN32
40 # define TCL_CFGVAL_ENCODING "cp1252"
41 # else
42 # define TCL_CFGVAL_ENCODING "iso8859-1"
43 # endif
44 #endif
45
46 /*
47 * Use C preprocessor statements to define the various values for the embedded
48 * configuration information.
49 */
50
51 #ifdef TCL_THREADS
52 # define CFG_THREADED "1"
53 #else
54 # define CFG_THREADED "0"
55 #endif
56
57 #ifdef TCL_MEM_DEBUG
58 # define CFG_MEMDEBUG "1"
59 #else
60 # define CFG_MEMDEBUG "0"
61 #endif
62
63 #ifdef TCL_COMPILE_DEBUG
64 # define CFG_COMPILE_DEBUG "1"
65 #else
66 # define CFG_COMPILE_DEBUG "0"
67 #endif
68
69 #ifdef TCL_COMPILE_STATS
70 # define CFG_COMPILE_STATS "1"
71 #else
72 # define CFG_COMPILE_STATS "0"
73 #endif
74
75 #ifdef TCL_CFG_DO64BIT
76 # define CFG_64 "1"
77 #else
78 # define CFG_64 "0"
79 #endif
80
81 #ifndef NDEBUG
82 # define CFG_DEBUG "1"
83 #else
84 # define CFG_DEBUG "0"
85 #endif
86
87 #ifdef TCL_CFG_OPTIMIZED
88 # define CFG_OPTIMIZED "1"
89 #else
90 # define CFG_OPTIMIZED "0"
91 #endif
92
93 #ifdef TCL_CFG_PROFILED
94 # define CFG_PROFILED "1"
95 #else
96 # define CFG_PROFILED "0"
97 #endif
98
99 /*
100 The macOS framework build first installs the framework in the build
101 directory and then copies it to /Library/Frameworks/Tcl.framework.
102 Without these macros the pkgconfig paths point into the build
103 directory instead of into the installed framework.
104 */
105
106 #if defined(MAC_OSX_TCL) && defined(TCL_FRAMEWORK)
107 #define VERSION_DIR "/Library/Frameworks/Tcl.framework/Versions/"TCL_VERSION
108 #undef CFG_INSTALL_LIBDIR
109 #undef CFG_RUNTIME_LIBDIR
110 #undef CFG_INSTALL_BINDIR
111 #undef CFG_RUNTIME_BINDIR
112 #undef CFG_INSTALL_DOCDIR
113 #undef CFG_RUNTIME_DOCDIR
114 #undef CFG_INSTALL_SCRDIR
115 #undef CFG_RUNTIME_SCRDIR
116 #undef CFG_INSTALL_INCDIR
117 #undef CFG_RUNTIME_INCDIR
118 #undef CFG_INSTALL_DEMODIR
119 #undef CFG_RUNTIME_DEMODIR
120 #define CFG_INSTALL_LIBDIR VERSION_DIR
121 #define CFG_RUNTIME_LIBDIR CFG_INSTALL_LIBDIR
122 #define CFG_INSTALL_BINDIR VERSION_DIR
123 #define CFG_RUNTIME_BINDIR CFG_INSTALL_BINDIR
124 #define CFG_INSTALL_DOCDIR VERSION_DIR "/Resources/Documentation"
125 #define CFG_RUNTIME_DOCDIR CFG_INSTALL_DOCDIR
126 #define CFG_INSTALL_SCRDIR VERSION_DIR "/Resources/Scripts"
127 #define CFG_RUNTIME_SCRDIR CFG_INSTALL_SCRDIR
128 #define CFG_INSTALL_INCDIR VERSION_DIR "/Headers"
129 #define CFG_RUNTIME_INCDIR CFG_INSTALL_INCDIR
130 #endif
131
132 static Tcl_Config const cfg[] = {
133 {"debug", CFG_DEBUG},
134 {"threaded", CFG_THREADED},
135 {"profiled", CFG_PROFILED},
136 {"64bit", CFG_64},
137 {"optimized", CFG_OPTIMIZED},
138 {"mem_debug", CFG_MEMDEBUG},
139 {"compile_debug", CFG_COMPILE_DEBUG},
140 {"compile_stats", CFG_COMPILE_STATS},
141
142 /* Runtime paths to various stuff */
143
144 {"libdir,runtime", CFG_RUNTIME_LIBDIR},
145 {"bindir,runtime", CFG_RUNTIME_BINDIR},
146 {"scriptdir,runtime", CFG_RUNTIME_SCRDIR},
147 {"includedir,runtime", CFG_RUNTIME_INCDIR},
148 {"docdir,runtime", CFG_RUNTIME_DOCDIR},
149 #if !defined(STATIC_BUILD) && defined(CFG_RUNTIME_DLLFILE)
150 {"dllfile,runtime", CFG_RUNTIME_DLLFILE},
151 #endif
152
153 /* Installation paths to various stuff */
154
155 {"libdir,install", CFG_INSTALL_LIBDIR},
156 {"bindir,install", CFG_INSTALL_BINDIR},
157 {"scriptdir,install", CFG_INSTALL_SCRDIR},
158 {"includedir,install", CFG_INSTALL_INCDIR},
159 {"docdir,install", CFG_INSTALL_DOCDIR},
160
161 /* Last entry, closes the array */
162 {NULL, NULL}
163 };
164
165 void
166 TclInitEmbeddedConfigurationInformation(
167 Tcl_Interp *interp) /* Interpreter the configuration command is
168 * registered in. */
169 {
170 Tcl_RegisterConfig(interp, "tcl", cfg, TCL_CFGVAL_ENCODING);
171 }
172
173 /*
174 * Local Variables:
175 * mode: c
176 * c-basic-offset: 4
177 * fill-column: 78
178 * End:
179 */