From c34c9a50016f31db443a9afdf717f48eca9d34d9 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 12 Jun 1996 04:20:27 +0000 Subject: [PATCH] provide access to $(exec_)prefix --- Modules/Makefile.pre.in | 2 ++ Modules/getpath.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Modules/Makefile.pre.in b/Modules/Makefile.pre.in index 69eb540f8ec..95321d072a6 100644 --- a/Modules/Makefile.pre.in +++ b/Modules/Makefile.pre.in @@ -106,6 +106,8 @@ clobber: clean getpath.o: getpath.c Makefile $(CC) -c $(CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \ + -DPREFIX='"$(prefix)"' \ + -DEXEC_PREFIX='"$(exec_prefix)"' \ $(srcdir)/getpath.c config.c Makefile: Makefile.pre config.c.in $(MAKESETUP) Setup diff --git a/Modules/getpath.c b/Modules/getpath.c index 4f49cc3a1f7..a502d37a1d1 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -32,6 +32,14 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define PYTHONPATH ".:/usr/local/lib/python" #endif +#ifndef PREFIX +#define PREFIX "/usr/local" +#endif + +#ifndef EXEC_PREFIX +#define EXEC_PREFIX "/usr/local" +#endif + /* This is called once from pythonrun to initialize sys.path. The environment variable PYTHONPATH is fetched and the default path @@ -65,3 +73,18 @@ Py_GetPath() strcpy(p, defpath); return buf; } + + +/* Similar for Makefile variables $prefix and $exec_prefix */ + +char * +Py_GetPrefix() +{ + return PREFIX; +} + +char * +Py_GetExecPrefix() +{ + return EXEC_PREFIX; +}