From ac405f6c4ec7215b7d8f88e4002a1322eaba3df1 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 12 Sep 1994 10:56:06 +0000 Subject: [PATCH] Shared library support --- Makefile.in | 21 ++++++++++++++++ configure.in | 69 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 87 insertions(+), 3 deletions(-) diff --git a/Makefile.in b/Makefile.in index 1fe5701fe33..3f12b407a95 100644 --- a/Makefile.in +++ b/Makefile.in @@ -29,6 +29,9 @@ srcdir= @srcdir@ VPATH= @srcdir@ INSTALL= @INSTALL@ +# Machine-dependent subdirectories +MACHDEP= @MACHDEP@ + # Install prefixes are treated specially by the configure script: # it only changes these lines if it has received a --prefix=... or # --exec-prefix=... command line option. Note that $(prefix) is @@ -42,6 +45,13 @@ prefix= /usr/local # Install prefix for architecture-dependent files exec_prefix= $(prefix) +# Symbols used for using shared libraries +SO= @SO@ +LDSHARED= @LDSHARED@ +CCSHARED= @CCSHARED@ +LINKFORSHARED= @LINKFORSHARED@ +DESTSHARED= $(prefix)/lib/python/$(MACHDEP) + # Programs SHELL= /bin/sh @@ -132,6 +142,17 @@ libainstall: all $(INSTALL) config.h $(LIBPL)/config.h $(INSTALL) $(srcdir)/Python/frozenmain.c $(LIBPL)/frozenmain.c +# install the dynamically loadable modules +sharedinstall: + cd Modules; $(MAKE) \ + OPT="$(OPT)" \ + SO="$(SO)" \ + LDSHARED="$(LDSHARED)" \ + CCSHARED="$(CCSHARED)" \ + LINKFORSHARED="$(LINKFORSHARED)" \ + DESTSHARED="$(DESTSHARED)" \ + sharedinstall + # Build the sub-Makefiles Makefiles: config.status (cd Modules; $(MAKE) -f Makefile.pre Makefile) diff --git a/configure.in b/configure.in index 67ae07a0841..e27fa5bb332 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ -dnl Process this file with autoconf 1.8 or later to produce a configure script. +dnl Process this file with autoconf 1.8 or later to make a configure script. AC_REVISION($Revision$)dnl -AC_PREREQ(1.8)dnl +AC_PREREQ(1.11)dnl AC_INIT(Include/object.h) AC_CONFIG_HEADER(config.h)dnl # Don't suppress compiler output when --verbose is specified @@ -59,6 +59,69 @@ AC_RETSIGTYPE AC_SIZE_T AC_UID_T +# Set name for machine-dependent library files +AC_SUBST(MACHDEP) +if test -z "$MACHDEP" +then + ac_system=`uname -s | tr '[[A-Z]]' '[[a-z]]'` + ac_release=`uname -r | sed 's/\..*//'` + MACHDEP="$ac_system$ac_release" + case MACHDEP in + '') MACHDEP=unknown;; + esac + AC_VERBOSE(setting MACHDEP to '$MACHDEP') +fi + +# Set info about shared libraries. +# XXX This should try things out instead of testing uname! +AC_SUBST(SO) +AC_SUBST(LDSHARED) +AC_SUBST(CCSHARED) +AC_SUBST(LINKFORSHARED) +ac_system=`uname -s` +ac_release=`uname -r` +# SO is the extension of shared libraries `(including the dot!) +# -- usually .so, .sl on HP-UX +if test -z "$SO" +then + case $ac_system in + hp*|HP*) SO=.sl;; + *) SO=.so;; + esac + AC_VERBOSE(setting SO to '$SO') +fi +# 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 +if test -z "$LDSHARED" +then + case $ac_system/$ac_release in + IRIX*) LDSHARED="ld -shared";; + SunOS/4*) LDSHARED="ld";; + SunOS/5*) LDSHARED="ld -G";; + hp*|HP*) LDSHARED="ld -b";; + *) LDSHARED="ld";; + esac + AC_VERBOSE(setting LDSHARED= to '$LDSHARED') +fi +# CCSHARED are the C *flags* used to create objects to go into a shared +# library -- this is only needed for HP-UX +if test -z "$CCSHARED" +then + case $ac_system in + hp*|HP*) CCSHARED="+z";; + esac + AC_VERBOSE(setting CCSHARED= to '$CCSHARED') +fi +# LINKFORSHARED are the flags passed to the $(CC) command that links +# the python executable -- this is only needed for HP-UX +if test -z "$LINKFORSHARED" +then + case $ac_system in + hp*|HP*) LINKFORSHARED="-Wl,-E";; + esac + AC_VERBOSE(setting LINKFORSHARED to '$LINKFORSHARED') +fi + # checks for libraries AC_HAVE_LIBRARY(dl) @@ -151,7 +214,7 @@ AC_CHAR_UNSIGNED AC_CONST -AC_COMPILE_CHECK([wheter we have signed char], [], [signed char c;], [], AC_DEFINE(signed, [])) +AC_COMPILE_CHECK([signed char], [], [signed char c;], [], AC_DEFINE(signed, [])) AC_CHECKING(for prototypes) AC_TEST_PROGRAM([