Patches by William Lewis for Nextstep descendants.

This commit is contained in:
Guido van Rossum 1999-01-27 17:53:11 +00:00
parent b5cebfe164
commit 54ecc3d24f
13 changed files with 688 additions and 327 deletions

View File

@ -161,6 +161,7 @@ DIST= $(DISTFILES) $(DISTDIRS)
CFLAGS= $(OPT) -I. $(DEFS) CFLAGS= $(OPT) -I. $(DEFS)
LIBRARY= libpython$(VERSION).a LIBRARY= libpython$(VERSION).a
LDLIBRARY= @LDLIBRARY@
# Default target # Default target
all: $(LIBRARY) python sharedmods all: $(LIBRARY) python sharedmods
@ -173,10 +174,10 @@ python: $(LIBRARY) buildno Modules/python.o
$(srcdir)/Modules/getbuildinfo.c $(srcdir)/Modules/getbuildinfo.c
$(AR) cr $(LIBRARY) getbuildinfo.o $(AR) cr $(LIBRARY) getbuildinfo.o
$(RANLIB) $(LIBRARY) $(RANLIB) $(LIBRARY)
@DGUX_IS_BROKEN@ @MAKE_LDLIBRARY@
cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \ cd Modules; $(MAKE) OPT="$(OPT)" VERSION="$(VERSION)" \
prefix="$(prefix)" exec_prefix="$(exec_prefix)" \ prefix="$(prefix)" exec_prefix="$(exec_prefix)" \
LIBRARY=../$(LIBRARY) link LIBRARY=../$(LDLIBRARY) link
Modules/python.o: $(srcdir)/Modules/python.c Modules/python.o: $(srcdir)/Modules/python.c
cd Modules; $(MAKE) OPT="$(OPT)" python.o cd Modules; $(MAKE) OPT="$(OPT)" python.o
@ -204,6 +205,10 @@ libpython$(VERSION).so: $(LIBRARY)
(cd dgux;ar x ../$^;ld -G -o ../$@ * ) (cd dgux;ar x ../$^;ld -G -o ../$@ * )
/bin/rm -rf ./dgux /bin/rm -rf ./dgux
# This rule is here for OPENSTEP/Rhapsody/MacOSX
libpython$(VERSION).dylib: $(LIBRARY)
libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) -framework System @LIBTOOL_CRUFT@
$(SUBDIRS): Makefiles $(SUBDIRS): Makefiles
Parser: Parser:
@ -258,7 +263,6 @@ altbininstall: python
fi; \ fi; \
done done
$(INSTALL_PROGRAM) python$(EXE) $(BINDIR)/python$(VERSION)$(EXE) $(INSTALL_PROGRAM) python$(EXE) $(BINDIR)/python$(VERSION)$(EXE)
@DGUX_IS_BROKEN@
if test -f libpython$(VERSION).so; then \ if test -f libpython$(VERSION).so; then \
$(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \ $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
else true; \ else true; \
@ -504,7 +508,7 @@ clean: localclean
done done
localclobber: localclean localclobber: localclean
-rm -f tags TAGS python $(LIBRARY) *.o -rm -f tags TAGS python $(LIBRARY) $(LDLIBRARY) *.o
-rm -f config.log config.cache config.h -rm -f config.log config.cache config.h
clobber: localclobber clobber: localclobber

View File

@ -100,7 +100,7 @@ MAINOBJ= python.o
SYSLIBS= $(LIBM) $(LIBC) SYSLIBS= $(LIBM) $(LIBC)
LIBRARY= ../libpython$(VERSION).a LIBRARY= ../libpython$(VERSION).a
REALLIBRARY= ../@REALLIBRARY@ LDLIBRARY= ../@LDLIBRARY@
# === Rules === # === Rules ===
@ -123,7 +123,7 @@ EXE=
# This target is used by the master Makefile to link the final binary. # This target is used by the master Makefile to link the final binary.
link: $(MAINOBJ) link: $(MAINOBJ)
$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) $(MAINOBJ) \ $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) $(MAINOBJ) \
$(LIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST) $(LDLIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
mv python$(EXE) ../python$(EXE) mv python$(EXE) ../python$(EXE)
clean: clean:

View File

@ -30,7 +30,7 @@
const char * const char *
Py_GetBuildInfo() Py_GetBuildInfo()
{ {
static char buildinfo[40]; static char buildinfo[50];
sprintf(buildinfo, "#%d, %.12s, %.8s", BUILD, DATE, TIME); sprintf(buildinfo, "#%d, %.20s, %.9s", BUILD, DATE, TIME);
return buildinfo; return buildinfo;
} }

View File

@ -42,6 +42,10 @@ PERFORMANCE OF THIS SOFTWARE.
#include <unistd.h> #include <unistd.h>
#endif /* HAVE_UNISTD_H */ #endif /* HAVE_UNISTD_H */
#ifdef WITH_NEXT_FRAMEWORK
#include <mach-o/dyld.h>
#endif
/* Search in some common locations for the associated Python libraries. /* Search in some common locations for the associated Python libraries.
* *
* Two directories must be found, the platform independent directory * Two directories must be found, the platform independent directory
@ -394,6 +398,23 @@ calculate_path()
int bufsz; int bufsz;
int prefixsz; int prefixsz;
char *defpath = pythonpath; char *defpath = pythonpath;
#ifdef WITH_NEXT_FRAMEWORK
NSModule pythonModule;
#endif
#ifdef WITH_NEXT_FRAMEWORK
pythonModule = NSModuleForSymbol(NSLookupAndBindSymbol("_Py_Initialize"));
/* Use dylib functions to find out where the framework was loaded from */
buf = NSLibraryNameForModule(pythonModule);
if (buf != NULL) {
/* We're in a framework. */
strcpy(progpath, buf);
/* Frameworks have support for versioning */
strcpy(lib_python, "lib");
} else {
/* If we're not in a framework, fall back to the old way (even though NSNameOfModule() probably does the same thing.) */
#endif
/* Initialize this dynamically for K&R C */ /* Initialize this dynamically for K&R C */
sprintf(lib_python, "lib/python%s", VERSION); sprintf(lib_python, "lib/python%s", VERSION);
@ -430,6 +451,9 @@ calculate_path()
} }
else else
progpath[0] = '\0'; progpath[0] = '\0';
#ifdef WITH_NEXT_FRAMEWORK
}
#endif
strcpy(argv0_path, progpath); strcpy(argv0_path, progpath);

View File

@ -146,6 +146,7 @@ corresponding Unix manual entries for more information on calls.";
#undef HAVE_UTIME_H #undef HAVE_UTIME_H
#define HAVE_WAITPID #define HAVE_WAITPID
/* #undef HAVE_GETCWD */ /* #undef HAVE_GETCWD */
#define UNION_WAIT /* This should really be checked for by autoconf */
#endif #endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
@ -255,6 +256,23 @@ extern int lstat Py_PROTO((const char *, struct stat *));
#include <io.h> #include <io.h>
#endif /* OS2 */ #endif /* OS2 */
#ifdef UNION_WAIT
/* Emulate some macros on systems that have a union instead of macros */
#ifndef WIFEXITED
#define WIFEXITED(u_wait) (!(u_wait).w_termsig && !(u_wait).w_coredump)
#endif
#ifndef WEXITSTATUS
#define WEXITSTATUS(u_wait) (WIFEXITED(u_wait)?((u_wait).w_retcode):-1)
#endif
#ifndef WTERMSIG
#define WTERMSIG(u_wait) ((u_wait).w_termsig)
#endif
#endif /* UNION_WAIT */
/* Return a dictionary corresponding to the POSIX environment table */ /* Return a dictionary corresponding to the POSIX environment table */
#if !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) ) #if !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
@ -1986,20 +2004,25 @@ posix_waitpid(self, args)
PyObject *self; PyObject *self;
PyObject *args; PyObject *args;
{ {
int pid, options, sts = 0; int pid, options;
#ifdef UNION_WAIT
union wait status;
#define status_i (status.w_status)
#else
int status;
#define status_i status
#endif
status_i = 0;
if (!PyArg_Parse(args, "(ii)", &pid, &options)) if (!PyArg_Parse(args, "(ii)", &pid, &options))
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
#ifdef NeXT pid = wait4(pid, &status, options, NULL);
pid = wait4(pid, (union wait *)&sts, options, NULL);
#else
pid = waitpid(pid, &sts, options);
#endif
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (pid == -1) if (pid == -1)
return posix_error(); return posix_error();
else else
return Py_BuildValue("ii", pid, sts); return Py_BuildValue("ii", pid, status_i);
} }
#endif /* HAVE_WAITPID */ #endif /* HAVE_WAITPID */
@ -2015,17 +2038,21 @@ posix_wait(self, args)
PyObject *args; PyObject *args;
{ {
int pid, sts; int pid, sts;
Py_BEGIN_ALLOW_THREADS #ifdef UNION_WAIT
#ifdef NeXT union wait status;
pid = wait((union wait *)&sts); #define status_i (status.w_status)
#else #else
pid = wait(&sts); int status;
#define status_i status
#endif #endif
status_i = 0;
Py_BEGIN_ALLOW_THREADS
pid = wait(&status);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (pid == -1) if (pid == -1)
return posix_error(); return posix_error();
else else
return Py_BuildValue("ii", pid, sts); return Py_BuildValue("ii", pid, status_i);
} }
#endif #endif
@ -2821,9 +2848,16 @@ posix_WIFSTOPPED(self, args)
PyObject *self; PyObject *self;
PyObject *args; PyObject *args;
{ {
int status = 0; #ifdef UNION_WAIT
union wait status;
#define status_i (status.w_status)
#else
int status;
#define status_i status
#endif
status_i = 0;
if (!PyArg_Parse(args, "i", &status)) if (!PyArg_Parse(args, "i", &status_i))
{ {
return NULL; return NULL;
} }
@ -2842,9 +2876,16 @@ posix_WIFSIGNALED(self, args)
PyObject *self; PyObject *self;
PyObject *args; PyObject *args;
{ {
int status = 0; #ifdef UNION_WAIT
union wait status;
#define status_i (status.w_status)
#else
int status;
#define status_i status
#endif
status_i = 0;
if (!PyArg_Parse(args, "i", &status)) if (!PyArg_Parse(args, "i", &status_i))
{ {
return NULL; return NULL;
} }
@ -2863,9 +2904,16 @@ posix_WIFEXITED(self, args)
PyObject *self; PyObject *self;
PyObject *args; PyObject *args;
{ {
int status = 0; #ifdef UNION_WAIT
union wait status;
#define status_i (status.w_status)
#else
int status;
#define status_i status
#endif
status_i = 0;
if (!PyArg_Parse(args, "i", &status)) if (!PyArg_Parse(args, "i", &status_i))
{ {
return NULL; return NULL;
} }
@ -2874,7 +2922,7 @@ posix_WIFEXITED(self, args)
} }
#endif /* WIFEXITED */ #endif /* WIFEXITED */
#ifdef WIFSTOPPED #ifdef WEXITSTATUS
static char posix_WEXITSTATUS__doc__[] = static char posix_WEXITSTATUS__doc__[] =
"WEXITSTATUS(status) -> integer\n\ "WEXITSTATUS(status) -> integer\n\
See Unix documentation."; See Unix documentation.";
@ -2884,9 +2932,16 @@ posix_WEXITSTATUS(self, args)
PyObject *self; PyObject *self;
PyObject *args; PyObject *args;
{ {
int status = 0; #ifdef UNION_WAIT
union wait status;
#define status_i (status.w_status)
#else
int status;
#define status_i status
#endif
status_i = 0;
if (!PyArg_Parse(args, "i", &status)) if (!PyArg_Parse(args, "i", &status_i))
{ {
return NULL; return NULL;
} }
@ -2905,9 +2960,16 @@ posix_WTERMSIG(self, args)
PyObject *self; PyObject *self;
PyObject *args; PyObject *args;
{ {
int status = 0; #ifdef UNION_WAIT
union wait status;
#define status_i (status.w_status)
#else
int status;
#define status_i status
#endif
status_i = 0;
if (!PyArg_Parse(args, "i", &status)) if (!PyArg_Parse(args, "i", &status_i))
{ {
return NULL; return NULL;
} }
@ -2926,9 +2988,16 @@ posix_WSTOPSIG(self, args)
PyObject *self; PyObject *self;
PyObject *args; PyObject *args;
{ {
int status = 0; #ifdef UNION_WAIT
union wait status;
#define status_i (status.w_status)
#else
int status;
#define status_i status
#endif
status_i = 0;
if (!PyArg_Parse(args, "i", &status)) if (!PyArg_Parse(args, "i", &status_i))
{ {
return NULL; return NULL;
} }

View File

@ -34,6 +34,7 @@ extern int rl_bind_key();
extern int rl_bind_key_in_map(); extern int rl_bind_key_in_map();
extern int rl_initialize(); extern int rl_initialize();
extern int add_history(); extern int add_history();
extern Function *rl_event_hook;
#endif #endif
/* Pointers needed from outside (but not declared in a header file). */ /* Pointers needed from outside (but not declared in a header file). */

View File

@ -38,8 +38,8 @@ PERFORMANCE OF THIS SOFTWARE.
const char * const char *
Py_GetVersion() Py_GetVersion()
{ {
static char version[80]; static char version[100];
sprintf(version, "%.10s (%.30s) %.30s", PY_VERSION, sprintf(version, "%.10s (%.40s) %.40s", PY_VERSION,
Py_GetBuildInfo(), Py_GetCompiler()); Py_GetBuildInfo(), Py_GetCompiler());
return version; return version;
} }

View File

@ -46,7 +46,8 @@ PERFORMANCE OF THIS SOFTWARE.
symbol -- defined for: symbol -- defined for:
DYNAMIC_LINK -- any kind of dynamic linking DYNAMIC_LINK -- any kind of dynamic linking
USE_RLD -- NeXT dynamic linking USE_RLD -- NeXT dynamic linking with FVM shlibs
USE_DYLD -- NeXT dynamic linking with frameworks
USE_DL -- Jack's dl for IRIX 4 or GNU dld with emulation for Jack's dl USE_DL -- Jack's dl for IRIX 4 or GNU dld with emulation for Jack's dl
USE_SHLIB -- SunOS or IRIX 5 (SVR4?) shared libraries USE_SHLIB -- SunOS or IRIX 5 (SVR4?) shared libraries
_AIX -- AIX style dynamic linking _AIX -- AIX style dynamic linking
@ -117,7 +118,15 @@ typedef FARPROC dl_funcptr;
#endif #endif
#endif #endif
#ifdef NeXT #ifdef WITH_DYLD
#define DYNAMIC_LINK
#define USE_DYLD
#define SHORT_EXT ".so"
#define LONG_EXT "module.so"
#define FUNCNAME_PATTERN "_init%.200s"
#endif
#if defined(NeXT) && !defined(DYNAMIC_LINK)
#define DYNAMIC_LINK #define DYNAMIC_LINK
#define USE_RLD #define USE_RLD
/* Define this to 1 if you want be able to load ObjC modules as well: /* Define this to 1 if you want be able to load ObjC modules as well:
@ -251,16 +260,22 @@ typedef void (*dl_funcptr)();
#ifdef USE_RLD #ifdef USE_RLD
#include <mach-o/rld.h> #include <mach-o/rld.h>
#define FUNCNAME_PATTERN "_init%.200s"
#ifndef _DL_FUNCPTR_DEFINED #ifndef _DL_FUNCPTR_DEFINED
typedef void (*dl_funcptr)(); typedef void (*dl_funcptr)();
#endif #endif
#endif /* USE_RLD */ #endif /* USE_RLD */
#ifdef USE_DYLD
#include <mach-o/dyld.h>
#ifndef _DL_FUNCPTR_DEFINED
typedef void (*dl_funcptr)();
#endif
#endif /* USE_DYLD */
extern char *Py_GetProgramName(); extern char *Py_GetProgramName();
#ifndef FUNCNAME_PATTERN #ifndef FUNCNAME_PATTERN
#if defined(__hp9000s300) || (defined(__NetBSD__) || defined(__FreeBSD__)) && !defined(__ELF__) || defined(__OpenBSD__) || defined(__BORLANDC__) #if defined(__hp9000s300) || (defined(__NetBSD__) || defined(__FreeBSD__)) && !defined(__ELF__) || defined(__OpenBSD__) || defined(__BORLANDC__) || defined(NeXT)
#define FUNCNAME_PATTERN "_init%.200s" #define FUNCNAME_PATTERN "_init%.200s"
#else #else
#define FUNCNAME_PATTERN "init%.200s" #define FUNCNAME_PATTERN "init%.200s"
@ -653,6 +668,58 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
return NULL; return NULL;
} }
#endif /* USE_RLD */ #endif /* USE_RLD */
#ifdef USE_DYLD
/* This is also NeXT-specific. However, frameworks (the new style
of shared library) and rld() can't be used in the same program;
instead, you have to use dyld, which is mostly unimplemented. */
{
NSObjectFileImageReturnCode rc;
NSObjectFileImage image;
NSModule newModule;
NSSymbol theSym;
void *symaddr;
const char *errString;
rc = NSCreateObjectFileImageFromFile(pathname, &image);
switch(rc) {
default:
case NSObjectFileImageFailure:
NSObjectFileImageFormat:
/* for these a message is printed on stderr by dyld */
errString = "Can't create object file image";
break;
case NSObjectFileImageSuccess:
errString = NULL;
break;
case NSObjectFileImageInappropriateFile:
errString = "Inappropriate file type for dynamic loading";
break;
case NSObjectFileImageArch:
errString = "Wrong CPU type in object file";
break;
NSObjectFileImageAccess:
errString = "Can't read object file (no access)";
break;
}
if (errString == NULL) {
newModule = NSLinkModule(image, pathname, TRUE);
if (!newModule)
errString = "Failure linking new module";
}
if (errString != NULL) {
PyErr_SetString(PyExc_ImportError, errString);
return NULL;
}
if (!NSIsSymbolNameDefined(funcname)) {
/* UnlinkModule() isn't implimented in current versions, but calling it does no harm */
NSUnLinkModule(newModule, FALSE);
PyErr_Format(PyExc_ImportError, "Loaded module does not contain symbol %s", funcname);
return NULL;
}
theSym = NSLookupAndBindSymbol(funcname);
p = (dl_funcptr)NSAddressOfSymbol(theSym);
}
#endif /* USE_DYLD */
#ifdef hpux #ifdef hpux
{ {
shl_t lib; shl_t lib;

View File

@ -1,10 +1,6 @@
/* strdup() replacement (from stdwin, if you must know) */ /* strdup() replacement (from stdwin, if you must know) */
#include "config.h" #include "pgenheaders.h"
#include "myproto.h"
#include "mymalloc.h"
#include <string.h>
char * char *
strdup(str) strdup(str)

View File

@ -18,6 +18,9 @@
/* Define to `long' if <time.h> doesn't define. */ /* Define to `long' if <time.h> doesn't define. */
#undef clock_t #undef clock_t
/* Used for BeOS configuration */
#undef DL_EXPORT_HEADER
/* Define if getpgrp() must be called as getpgrp(0). */ /* Define if getpgrp() must be called as getpgrp(0). */
#undef GETPGRP_HAVE_ARG #undef GETPGRP_HAVE_ARG
@ -93,9 +96,18 @@
shared libraries */ shared libraries */
#undef WITH_DL_DLD #undef WITH_DL_DLD
/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
dynamic linker (dyld) instead of the old-style (NextStep) dynamic
linker (rld). Dyld is necessary to support frameworks. */
#undef WITH_DYLD
/* Define if you want to compile in rudimentary thread support */ /* Define if you want to compile in rudimentary thread support */
#undef WITH_THREAD #undef WITH_THREAD
/* Define if you want to produce an OpenStep/Rhapsody framework
(shared library plus accessory files). */
#undef WITH_NEXT_FRAMEWORK
/* The number of bytes in an off_t. */ /* The number of bytes in an off_t. */
#undef SIZEOF_OFF_T #undef SIZEOF_OFF_T

View File

@ -79,6 +79,9 @@
/* Define to `long' if <time.h> doesn't define. */ /* Define to `long' if <time.h> doesn't define. */
#undef clock_t #undef clock_t
/* Used for BeOS configuration */
#undef DL_EXPORT_HEADER
/* Define if getpgrp() must be called as getpgrp(0). */ /* Define if getpgrp() must be called as getpgrp(0). */
#undef GETPGRP_HAVE_ARG #undef GETPGRP_HAVE_ARG
@ -148,9 +151,18 @@
shared libraries */ shared libraries */
#undef WITH_DL_DLD #undef WITH_DL_DLD
/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
dynamic linker (dyld) instead of the old-style (NextStep) dynamic
linker (rld). Dyld is necessary to support frameworks. */
#undef WITH_DYLD
/* Define if you want to compile in rudimentary thread support */ /* Define if you want to compile in rudimentary thread support */
#undef WITH_THREAD #undef WITH_THREAD
/* Define if you want to produce an OpenStep/Rhapsody framework
(shared library plus accessory files). */
#undef WITH_NEXT_FRAMEWORK
/* The number of bytes in an off_t. */ /* The number of bytes in an off_t. */
#undef SIZEOF_OFF_T #undef SIZEOF_OFF_T
@ -453,9 +465,3 @@
/* Define if you have the m library (-lm). */ /* Define if you have the m library (-lm). */
#undef HAVE_LIBM #undef HAVE_LIBM
/* Define if you have special dynamic linkage requirements in declarations. */
#undef DL_EXPORT_HEADER
#ifdef DL_EXPORT_HEADER
#include DL_EXPORT_HEADER
#endif

620
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ AC_SUBST(VERSION)
VERSION=1.5 VERSION=1.5
# NEXTSTEP stuff # NEXTSTEP stuff
if test -f /usr/lib/NextStep/software_version; then if test -f /usr/lib/NextStep/software_version -o -f /System/Library/CoreServices/software_version ; then
AC_MSG_CHECKING(for --with-next-archs) AC_MSG_CHECKING(for --with-next-archs)
AC_ARG_WITH(next-archs, AC_ARG_WITH(next-archs,
@ -24,7 +24,7 @@ if test -f /usr/lib/NextStep/software_version; then
if test -z "$MACHDEP" if test -z "$MACHDEP"
then then
set X `hostinfo | grep 'NeXT Mach.*:' | \ set X `hostinfo | egrep '(NeXT Mach|Kernel Release).*:' | \
sed -e 's/://' -e 's/\./_/'` && \ sed -e 's/://' -e 's/\./_/'` && \
ac_sys_system=next && ac_sys_release=$4 ac_sys_system=next && ac_sys_release=$4
@ -32,6 +32,10 @@ if test -f /usr/lib/NextStep/software_version; then
fi fi
fi fi
AC_ARG_WITH(next-framework,
[--with-next-framework Build (OpenStep|Rhapsody|MacOS10) framework],,)
AC_ARG_WITH(dyld,
[--with-dyld Use (OpenStep|Rhapsody|MacOS10) dynamic linker],,)
# Set name for machine-dependent library files # Set name for machine-dependent library files
AC_SUBST(MACHDEP) AC_SUBST(MACHDEP)
@ -172,6 +176,14 @@ BeOS*)
esac;; esac;;
esac esac
# LDLIBRARY is the name of the library to link against (as opposed to the
# name of the library into which to insert object files). On systems
# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
# the Makefiles).
AC_SUBST(MAKE_LDLIBRARY)
AC_SUBST(LDLIBRARY)
LDLIBRARY=''
# LINKCC is the command that links the python executable -- default is $(CC). # LINKCC is the command that links the python executable -- default is $(CC).
# This is altered for AIX and BeOS in order to build the export list before # This is altered for AIX and BeOS in order to build the export list before
# linking. # linking.
@ -184,7 +196,7 @@ then
LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";; LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
BeOS*) BeOS*)
LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) \$(OPT)" LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) \$(OPT)"
REALLIBRARY='libpython$(VERSION).so';; LDLIBRARY='libpython$(VERSION).so';;
dgux*) dgux*)
LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";; LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
*) LINKCC="\$(PURIFY) \$(CC)";; *) LINKCC="\$(PURIFY) \$(CC)";;
@ -192,13 +204,38 @@ then
fi fi
AC_MSG_RESULT($LINKCC) AC_MSG_RESULT($LINKCC)
AC_MSG_CHECKING(LDLIBRARY)
# NeXT framework builds require that the 'ar' library be converted into
# a bundle using libtool.
if test "$with_next_framework"
then
LDLIBRARY='libpython$(VERSION).dylib'
fi
# DG/UX requires some fancy ld contortions to produce a .so from an .a
if test "$MACHDEP" = "dguxR4"
then
LDLIBRARY='libpython$(VERSION).so'
OPT="$OPT -pic"
fi
AC_MSG_RESULT($LDLIBRARY)
# If LDLIBRARY is different from LIBRARY, emit a rule to build it.
if test -z "$LDLIBRARY"
then
LDLIBRARY='libpython$(VERSION).a'
MAKE_LDLIBRARY="true"
else
MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)'
fi
AC_PROG_RANLIB AC_PROG_RANLIB
AC_SUBST(AR) AC_SUBST(AR)
AC_CHECK_PROGS(AR, ar aal, ar) AC_CHECK_PROGS(AR, ar aal, ar)
AC_SUBST(INSTALL) AC_SUBST(INSTALL)
AC_SUBST(INSTALL_PROGRAM) AC_SUBST(INSTALL_PROGRAM)
AC_SUBST(INSTALL_DATA) AC_SUBST(INSTALL_DATA)
AC_SUBST(REALLIBRARY)
# Install just never works :-( # Install just never works :-(
if test -z "$INSTALL" if test -z "$INSTALL"
then then
@ -268,17 +305,6 @@ else
fi fi
fi fi
AC_SUBST(DGUX_IS_BROKEN)
if test "$MACHDEP" != "dguxR4"
then
REALLIBRARY='libpython$(VERSION).a'
DGUX_IS_BROKEN="true"
else
REALLIBRARY='libpython$(VERSION).so'
OPT="$OPT -pic"
DGUX_IS_BROKEN="make $REALLIBRARY"
fi
# check for ANSI or K&R ("traditional") preprocessor # check for ANSI or K&R ("traditional") preprocessor
AC_MSG_CHECKING(for C preprocessor type) AC_MSG_CHECKING(for C preprocessor type)
AC_TRY_COMPILE([ AC_TRY_COMPILE([
@ -356,6 +382,45 @@ else
fi fi
# Minor variations in building a framework between NextStep versions 4 and 5
AC_SUBST(LIBTOOL_CRUFT)
case $ac_sys_system/$ac_sys_release in
next/4*)
ns_undef_sym='__environ'
LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
next/5*)
ns_undef_sym='_environ'
LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
esac
AC_MSG_CHECKING(for --with-next-framework)
if test "$with_next_framework"
then
OPT="$OPT -fno-common"
# -U __environ is needed since bundles don't have access
# to crt0 when built but will always be linked against it
LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
AC_DEFINE(WITH_NEXT_FRAMEWORK)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(for --with-dyld)
if test "$with_next_framework" -o "$with_dyld"
then
if test "$with_dyld"
then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(required for framework build)
fi
AC_DEFINE(WITH_DYLD)
ns_dyld='set'
else
AC_MSG_RESULT(no)
fi
# Set info about shared libraries. # Set info about shared libraries.
AC_SUBST(SO) AC_SUBST(SO)
AC_SUBST(LDSHARED) AC_SUBST(LDSHARED)
@ -374,6 +439,8 @@ fi
AC_MSG_RESULT($SO) AC_MSG_RESULT($SO)
# LDSHARED is the ld *command* used to create shared library # LDSHARED is the ld *command* used to create shared library
# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5 # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
# (Shared libraries in this instance are shared modules to be loaded into
# Python, as opposed to building Python itself as a shared library.)
AC_MSG_CHECKING(LDSHARED) AC_MSG_CHECKING(LDSHARED)
if test -z "$LDSHARED" if test -z "$LDSHARED"
then then
@ -387,7 +454,14 @@ then
hp*|HP*) LDSHARED="ld -b";; hp*|HP*) LDSHARED="ld -b";;
OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
DYNIX/ptx*) LDSHARED="ld -G";; DYNIX/ptx*) LDSHARED="ld -G";;
next/*) LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';; next/*)
if test "$ns_dyld"
then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
fi
if test "$with_next_framework" ; then
LDSHARED="$LDSHARED \$(LDLIBRARY)"
fi ;;
Linux*) LDSHARED="gcc -shared";; Linux*) LDSHARED="gcc -shared";;
dgux*) LDSHARED="ld -G";; dgux*) LDSHARED="ld -G";;
FreeBSD*/3*) LDSHARED="gcc -shared";; FreeBSD*/3*) LDSHARED="gcc -shared";;
@ -405,7 +479,7 @@ then
fi fi
AC_MSG_RESULT($LDSHARED) AC_MSG_RESULT($LDSHARED)
# CCSHARED are the C *flags* used to create objects to go into a shared # CCSHARED are the C *flags* used to create objects to go into a shared
# library -- this is only needed for a few systems # library (module) -- this is only needed for a few systems
AC_MSG_CHECKING(CCSHARED) AC_MSG_CHECKING(CCSHARED)
if test -z "$CCSHARED" if test -z "$CCSHARED"
then then
@ -436,7 +510,13 @@ then
LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
FreeBSD/3*) LINKFORSHARED="-Xlinker -export-dynamic";; FreeBSD/3*) LINKFORSHARED="-Xlinker -export-dynamic";;
Linux*) LINKFORSHARED="-Xlinker -export-dynamic";; Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
next/*) LINKFORSHARED="-u libsys_s";; # -u libsys_s pulls in all symbols in libsys
next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
# -u __dummy makes the linker aware of the objc runtime
# in System.framework; otherwise, __objcInit (referenced in
# crt1.o) gets erroneously defined as common, which breaks dynamic
# loading of any modules which reference it in System.framework
next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
NetBSD*) NetBSD*)
if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]