Don't reference removed files in Makefile
[python/dscho.git] / Modules / config.c.in
blobd625067d9e4a360f0494989a8b7cb9e93e5d50c1
1 /* -*- C -*- ***********************************************
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3 The Netherlands.
5 All Rights Reserved
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose and without fee is hereby granted,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the names of Stichting Mathematisch
12 Centrum or CWI not be used in advertising or publicity pertaining to
13 distribution of the software without specific, written prior permission.
15 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 ******************************************************************/
25 /* Universal Python configuration file */
27 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif
31 #ifdef macintosh
32 /* The Macintosh main program is in macmain.c */
33 #define NO_MAIN
34 #endif
36 #include <stdio.h>
37 #include <string.h>
39 #include "myproto.h"
40 #include "mymalloc.h"
41 #include "osdefs.h"
42 #include "intrcheck.h"
44 #if defined(__cplusplus)
45 extern "C" {
46 #endif
48 #ifndef NO_MAIN
50 /* Normally, the main program is called from here (so everything else
51 can be in libPython.a). We save a pointer to argv[0] because it
52 may be needed for dynamic loading of modules in import.c. If you
53 have your own main program and want to use non-SunOS dynamic
54 loading, you will have to provide your own version of
55 getprogramname(). */
57 static char *argv0;
59 /* These are made available for other modules that might need them.
60 This is rare, but it is needed by the secureware module. */
62 static char **orig_argv;
63 static int orig_argc;
65 #if defined(__cplusplus)
66 int realmain(int, char**);
67 main(int argc, char **argv)
68 #else
69 main(argc, argv)
70 int argc;
71 char **argv;
72 #endif
74 orig_argc = argc;
75 orig_argv = argv;
76 argv0 = argv[0];
77 realmain(argc, argv);
80 char *
81 getprogramname()
83 return argv0;
86 void
87 #if defined(__cplusplus)
88 getargcargv(int *argc, char ***argv)
89 #else
90 getargcargv(argc,argv)
91 int *argc;
92 char ***argv;
93 #endif
95 *argc = orig_argc;
96 *argv = orig_argv;
99 #endif
102 /* Python version information */
104 #include "patchlevel.h"
106 /* Return the version string. This is constructed from the official
107 version number (from patchlevel.h), and the current date (if known
108 to the compiler, else a manually inserted date). */
110 #define VERSION "%s (%s)%s"
112 #ifdef __DATE__
113 #define DATE __DATE__
114 #else
115 #define DATE "Feb 13 1995"
116 #endif
118 #ifdef THINK_C
119 #define COMPILER " [THINK C]"
120 #endif
122 #ifdef __MWERKS__
123 #ifdef __powerc
124 #define COMPILER " [CW PPC]"
125 #else
126 #define COMPILER " [CW 68K]"
127 #endif
128 #endif
130 #ifdef MPW
131 #ifdef __SC__
132 #define COMPILER " [Symantec MPW]"
133 #else
134 #define COMPILER " [Apple MPW]"
135 #endif
136 #endif
138 #ifdef __GNUC__
139 #define COMPILER " [GCC " __VERSION__ "]"
140 #endif
142 #ifndef COMPILER
143 #define COMPILER ""
144 #endif
146 char *
147 getversion()
149 static char version[80];
150 sprintf(version, VERSION, PATCHLEVEL, DATE, COMPILER);
151 return version;
155 /* Return the copyright string. This is updated manually. */
157 char *
158 getcopyright()
160 return "Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam";
164 /* Return the initial python search path. This is called once from
165 initsys() to initialize sys.path.
166 The environment variable PYTHONPATH is fetched and the default path
167 appended. (The Mac has no environment variables, so there the
168 default path is always returned.) The default path may be passed
169 to the preprocessor; if not, a system-dependent default is used. */
171 #ifndef PYTHONPATH
172 #ifdef macintosh
173 #define PYTHONPATH ": :Lib :Lib:stdwin :Lib:test :Lib:mac"
174 #endif /* macintosh */
175 #endif /* !PYTHONPATH */
177 #ifndef PYTHONPATH
178 #if defined(MSDOS) || defined(NT)
179 #define PYTHONPATH ".;..\\lib;\\python\\lib"
180 #endif /* MSDOS || NT */
181 #endif /* !PYTHONPATH */
183 #ifndef PYTHONPATH
184 #define PYTHONPATH ".:/usr/local/lib/python"
185 #endif /* !PYTHONPATH */
187 #ifndef __cplusplus
188 extern char *getenv();
189 #endif
191 char *
192 getpythonpath()
194 #ifdef __cplusplus
195 void fatal(char *);
196 #endif
197 char *path = getenv("PYTHONPATH");
198 char *defpath = PYTHONPATH;
199 static char *buf = NULL;
200 char *p;
201 int n;
203 if (path == NULL)
204 path = "";
205 n = strlen(path) + strlen(defpath) + 2;
206 if (buf != NULL) {
207 free(buf);
208 buf = NULL;
210 buf = malloc(n);
211 if (buf == NULL)
212 fatal("not enough memory to copy module search path");
213 strcpy(buf, path);
214 p = buf + strlen(buf);
215 if (p != buf)
216 *p++ = DELIM;
217 strcpy(p, defpath);
218 return buf;
222 /* Table of built-in modules.
223 These are initialized when first imported.
224 Note: selection of optional extensions is now generally done by the
225 makesetup script. */
227 /* -- ADDMODULE MARKER 1 -- */
229 extern void initmarshal();
230 extern void initimp();
232 struct {
233 char *name;
234 void (*initfunc)();
235 } inittab[] = {
237 /* -- ADDMODULE MARKER 2 -- */
239 /* This module "lives in" with marshal.c */
240 {"marshal", initmarshal},
242 /* This lives it with import.c */
243 {"imp", initimp},
245 /* These entries are here for sys.builtin_module_names */
246 {"__main__", NULL},
247 {"__builtin__", NULL},
248 {"sys", NULL},
250 /* Sentinel */
251 {0, 0}
254 #ifndef USE_FROZEN
255 struct frozen {
256 char *name;
257 char *code;
258 int size;
259 } frozen_modules[] = {
260 {0, 0, 0}
262 #endif
264 #if defined(__cplusplus)
266 #endif