Commit aef734b1 authored by Guido van Rossum's avatar Guido van Rossum

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).
parent 5a53019b
...@@ -131,6 +131,7 @@ CFLAGS= $(OPT) -I. $(DEFS) ...@@ -131,6 +131,7 @@ CFLAGS= $(OPT) -I. $(DEFS)
LIBRARY= libpython$(VERSION).a LIBRARY= libpython$(VERSION).a
LDLIBRARY= @LDLIBRARY@ LDLIBRARY= @LDLIBRARY@
@SET_DLLLIBRARY@
# Default target # Default target
all: $(LIBRARY) python$(EXE) sharedmods all: $(LIBRARY) python$(EXE) sharedmods
...@@ -247,6 +248,10 @@ altbininstall: python$(EXE) ...@@ -247,6 +248,10 @@ altbininstall: python$(EXE)
$(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \ $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
else true; \ else true; \
fi fi
if test -f "$(DLLLIBRARY)"; then \
$(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \
else true; \
fi
# Install the manual page # Install the manual page
maninstall: maninstall:
...@@ -371,9 +376,9 @@ libainstall: all ...@@ -371,9 +376,9 @@ libainstall: all
else true; \ else true; \
fi; \ fi; \
done done
@if test -d $(LIBRARY); then :; else \ @if test -d $(LDLIBRARY); then :; else \
$(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \ $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
$(RANLIB) $(LIBPL)/$(LIBRARY) ; \ $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
fi fi
$(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
$(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o
......
...@@ -185,3 +185,15 @@ ...@@ -185,3 +185,15 @@
/* Leave that blank line there-- autoheader needs it! */ /* 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
...@@ -634,3 +634,13 @@ ...@@ -634,3 +634,13 @@
/* Define if you have the ieee library (-lieee). */ /* Define if you have the ieee library (-lieee). */
#undef HAVE_LIBIEEE #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
This diff is collapsed.
...@@ -237,10 +237,13 @@ esac ...@@ -237,10 +237,13 @@ esac
# LDLIBRARY is the name of the library to link against (as opposed to the # 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 # name of the library into which to insert object files). On systems
# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in # 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(MAKE_LDLIBRARY)
AC_SUBST(LDLIBRARY) AC_SUBST(LDLIBRARY)
AC_SUBST(SET_DLLLIBRARY)
LDLIBRARY='' LDLIBRARY=''
SET_DLLLIBRARY=''
# 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 in order to build the export list before # This is altered for AIX in order to build the export list before
...@@ -283,6 +286,10 @@ dguxR4) ...@@ -283,6 +286,10 @@ dguxR4)
beos*) beos*)
LDLIBRARY='libpython$(VERSION).so' LDLIBRARY='libpython$(VERSION).so'
;; ;;
cygwin*)
LDLIBRARY='libpython$(VERSION).dll.a'
SET_DLLLIBRARY='DLLLIBRARY= $(basename $(LDLIBRARY))'
;;
esac esac
AC_MSG_RESULT($LDLIBRARY) AC_MSG_RESULT($LDLIBRARY)
...@@ -292,7 +299,10 @@ then ...@@ -292,7 +299,10 @@ then
LDLIBRARY='libpython$(VERSION).a' LDLIBRARY='libpython$(VERSION).a'
MAKE_LDLIBRARY="true" MAKE_LDLIBRARY="true"
else else
MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)' case $MACHDEP in
cygwin*) MAKE_LDLIBRARY='$(MAKE) -C Modules ../$(DLLLIBRARY)';;
*) MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)';;
esac
fi fi
AC_PROG_RANLIB AC_PROG_RANLIB
...@@ -317,6 +327,7 @@ AC_SUBST(LN) ...@@ -317,6 +327,7 @@ AC_SUBST(LN)
if test -z "$LN" ; then if test -z "$LN" ; then
case $ac_sys_system in case $ac_sys_system in
BeOS*) LN="ln -s";; BeOS*) LN="ln -s";;
CYGWIN*) LN="ln -s";;
*) LN=ln;; *) LN=ln;;
esac esac
fi fi
...@@ -341,6 +352,11 @@ case $ac_sys_system in ...@@ -341,6 +352,11 @@ case $ac_sys_system in
Monterey*) OPT="";; Monterey*) OPT="";;
esac 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" if test "$ac_arch_flags"
then then
OPT="$OPT $ac_arch_flags" OPT="$OPT $ac_arch_flags"
...@@ -559,12 +575,13 @@ AC_SUBST(LDSHARED) ...@@ -559,12 +575,13 @@ AC_SUBST(LDSHARED)
AC_SUBST(CCSHARED) AC_SUBST(CCSHARED)
AC_SUBST(LINKFORSHARED) AC_SUBST(LINKFORSHARED)
# SO is the extension of shared libraries `(including the dot!) # 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) AC_MSG_CHECKING(SO)
if test -z "$SO" if test -z "$SO"
then then
case $ac_sys_system in case $ac_sys_system in
hp*|HP*) SO=.sl;; hp*|HP*) SO=.sl;;
CYGWIN*) SO=.dll;;
*) SO=.so;; *) SO=.so;;
esac esac
fi fi
...@@ -622,6 +639,7 @@ then ...@@ -622,6 +639,7 @@ then
fi;; fi;;
SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";; Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
*) LDSHARED="ld";; *) LDSHARED="ld";;
esac esac
fi fi
...@@ -646,6 +664,7 @@ then ...@@ -646,6 +664,7 @@ then
*gcc*) CCSHARED="-shared";; *gcc*) CCSHARED="-shared";;
*) CCSHARED="";; *) CCSHARED="";;
esac;; esac;;
CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
esac esac
fi fi
AC_MSG_RESULT($CCSHARED) AC_MSG_RESULT($CCSHARED)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment