Part of SF patch #102409 by jlt63: Cygwin Python DLL and Shared

Extension Patch.

Note: this could use some testing on NeXT, DG/UX, or BeOS, because of
the changes in the Makefile regarding $(LDLIBRARY).
This commit is contained in:
Guido van Rossum 2001-01-10 21:09:12 +00:00
parent 5a53019b0d
commit aef734b182
5 changed files with 395 additions and 329 deletions

View File

@ -131,6 +131,7 @@ CFLAGS= $(OPT) -I. $(DEFS)
LIBRARY= libpython$(VERSION).a
LDLIBRARY= @LDLIBRARY@
@SET_DLLLIBRARY@
# Default target
all: $(LIBRARY) python$(EXE) sharedmods
@ -247,6 +248,10 @@ altbininstall: python$(EXE)
$(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
else true; \
fi
if test -f "$(DLLLIBRARY)"; then \
$(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
else true; \
fi
# Install the manual page
maninstall:
@ -371,9 +376,9 @@ libainstall: all
else true; \
fi; \
done
@if test -d $(LIBRARY); then :; else \
$(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \
$(RANLIB) $(LIBPL)/$(LIBRARY) ; \
@if test -d $(LDLIBRARY); then :; else \
$(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
$(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
fi
$(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
$(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o

View File

@ -185,3 +185,15 @@
/* Leave that blank line there-- autoheader needs it! */
@BOTTOM@
#ifdef __CYGWIN__
#ifdef USE_DL_IMPORT
#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
#else
#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
#endif
#endif

View File

@ -634,3 +634,13 @@
/* Define if you have the ieee library (-lieee). */
#undef HAVE_LIBIEEE
#ifdef __CYGWIN__
#ifdef USE_DL_IMPORT
#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
#else
#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
#endif
#endif

666
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -237,10 +237,13 @@ 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).
# the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the
# shared (i.e., DLL) library.
AC_SUBST(MAKE_LDLIBRARY)
AC_SUBST(LDLIBRARY)
AC_SUBST(SET_DLLLIBRARY)
LDLIBRARY=''
SET_DLLLIBRARY=''
# LINKCC is the command that links the python executable -- default is $(CC).
# This is altered for AIX in order to build the export list before
@ -283,6 +286,10 @@ dguxR4)
beos*)
LDLIBRARY='libpython$(VERSION).so'
;;
cygwin*)
LDLIBRARY='libpython$(VERSION).dll.a'
SET_DLLLIBRARY='DLLLIBRARY= $(basename $(LDLIBRARY))'
;;
esac
AC_MSG_RESULT($LDLIBRARY)
@ -292,7 +299,10 @@ then
LDLIBRARY='libpython$(VERSION).a'
MAKE_LDLIBRARY="true"
else
MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)'
case $MACHDEP in
cygwin*) MAKE_LDLIBRARY='$(MAKE) -C Modules ../$(DLLLIBRARY)';;
*) MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)';;
esac
fi
AC_PROG_RANLIB
@ -317,6 +327,7 @@ AC_SUBST(LN)
if test -z "$LN" ; then
case $ac_sys_system in
BeOS*) LN="ln -s";;
CYGWIN*) LN="ln -s";;
*) LN=ln;;
esac
fi
@ -341,6 +352,11 @@ case $ac_sys_system in
Monterey*) OPT="";;
esac
# Cygwin does not need PIC compiler option so remove it to prevent warnings
case $ac_sys_system in
CYGWIN*) OPT="`echo $OPT | sed 's/ *-fPIC//'`";;
esac
if test "$ac_arch_flags"
then
OPT="$OPT $ac_arch_flags"
@ -559,12 +575,13 @@ AC_SUBST(LDSHARED)
AC_SUBST(CCSHARED)
AC_SUBST(LINKFORSHARED)
# SO is the extension of shared libraries `(including the dot!)
# -- usually .so, .sl on HP-UX
# -- usually .so, .sl on HP-UX, .dll on Cygwin
AC_MSG_CHECKING(SO)
if test -z "$SO"
then
case $ac_sys_system in
hp*|HP*) SO=.sl;;
CYGWIN*) SO=.dll;;
*) SO=.so;;
esac
fi
@ -622,6 +639,7 @@ then
fi;;
SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
*) LDSHARED="ld";;
esac
fi
@ -646,6 +664,7 @@ then
*gcc*) CCSHARED="-shared";;
*) CCSHARED="";;
esac;;
CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
esac
fi
AC_MSG_RESULT($CCSHARED)