diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7660c8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.pyc +.*.sw? +*.o +Modules/Setup +Modules/Setup.config +Modules/Setup.local +Modules/config.c +Makefile +Makefile.pre diff --git a/Include/pyerrors.h b/Include/pyerrors.h index a4233c9..0086c4e 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -58,7 +58,7 @@ typedef struct { PyObject *filename; } PyEnvironmentErrorObject; -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__WINE__) || defined(__MINGW32__) typedef struct { PyObject_HEAD PyObject *dict; @@ -153,7 +153,7 @@ PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError; PyAPI_DATA(PyObject *) PyExc_ValueError; PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__WINE__) || defined(__MINGW32__) PyAPI_DATA(PyObject *) PyExc_WindowsError; #endif #ifdef __VMS @@ -194,7 +194,7 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) Py_GCC_ATTRIBUTE((format(printf, 2, 3))); -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__WINE__) || defined(__MINGW32__) PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject( int, const char *); PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename( diff --git a/Include/pyport.h b/Include/pyport.h index 54411f2..f407f15 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -551,19 +551,19 @@ extern int fdatasync(int); BeOS and cygwin are the only other autoconf platform requiring special linkage handling and both of these use __declspec(). */ -#if defined(__CYGWIN__) || defined(__BEOS__) +#if defined(__CYGWIN__) || defined(__BEOS__) || defined(__MINGW32__) # define HAVE_DECLSPEC_DLL #endif /* only get special linkage if built as shared or platform is Cygwin */ -#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) +#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) || defined(__MINGW32__) # if defined(HAVE_DECLSPEC_DLL) # ifdef Py_BUILD_CORE # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE # define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE /* module init functions inside the core need no external linkage */ /* except for Cygwin to handle embedding (FIXME: BeOS too?) */ -# if defined(__CYGWIN__) +# if defined(__CYGWIN__) || defined(__MINGW32__) # define PyMODINIT_FUNC __declspec(dllexport) void # else /* __CYGWIN__ */ # define PyMODINIT_FUNC void @@ -573,7 +573,7 @@ extern int fdatasync(int); /* public Python functions and data are imported */ /* Under Cygwin, auto-import functions to prevent compilation */ /* failures similar to http://python.org/doc/FAQ.html#3.24 */ -# if !defined(__CYGWIN__) +# if !defined(__CYGWIN__) && !defined(__MINGW32__) # define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE # endif /* !__CYGWIN__ */ # define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE @@ -658,6 +658,12 @@ typedef struct fd_set { #define INT_MAX 2147483647 #endif +#ifdef __WINE__ /* weird: you have to typecast 0x7fffffffL to long */ +#undef LONG_MAX +#undef LONG_MIN +#define LONG_MAX ((long)0x7FFFFFFFL) +#define LONG_MIN ((long)(-LONG_MAX-1)) +#else #ifndef LONG_MAX #if SIZEOF_LONG == 4 #define LONG_MAX 0X7FFFFFFFL @@ -672,6 +678,8 @@ typedef struct fd_set { #define LONG_MIN (-LONG_MAX-1) #endif +#endif /* __WINE__ */ + #ifndef LONG_BIT #define LONG_BIT (8 * SIZEOF_LONG) #endif diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index 1b03835..75b2259 100644 --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -433,6 +433,8 @@ class LibraryLoader(object): cdll = LibraryLoader(CDLL) pydll = LibraryLoader(PyDLL) +#if _sys.version.find("mingw32") > 0: +# pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2]) if _os.name in ("nt", "ce"): pythonapi = PyDLL("python dll", None, _sys.dllhandle) elif _sys.platform == "cygwin": diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py index 87d6e27..9dcb4f0 100644 --- a/Lib/distutils/ccompiler.py +++ b/Lib/distutils/ccompiler.py @@ -1083,6 +1083,9 @@ def get_default_compiler(osname=None, platform=None): osname = os.name if platform is None: platform = sys.platform + if osname == 'nt' and sys.version.find('mingw') >= 0: + return 'mingw32' + for pattern, compiler in _default_compilers: if re.match(pattern, platform) is not None or \ re.match(pattern, osname) is not None: diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 1461409..5952fd5 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -181,7 +181,7 @@ class build_ext (Command): # for extensions under windows use different directories # for Release and Debug builds. # also Python's library directory must be appended to library_dirs - if os.name == 'nt': + if os.name == 'nt' and sys.version.find('mingw') >= 0: # the 'libs' directory is for binary installs - we assume that # must be the *native* platform. But we don't really support # cross-compiling via a binary install anyway, so we let it go. @@ -223,7 +223,9 @@ class build_ext (Command): # for extensions under Cygwin and AtheOS Python's library directory must be # appended to library_dirs - if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos': + if sys.platform[:6] == 'cygwin' or \ + sys.version.find('mingw') >= 0 or \ + sys.platform[:6] == 'atheos': if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")): # building third party extensions self.library_dirs.append(os.path.join(sys.prefix, "lib", @@ -677,7 +679,7 @@ class build_ext (Command): ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8] # extensions in debug_mode are named 'module_d.pyd' under windows so_ext = get_config_var('SO') - if os.name == 'nt' and self.debug: + if os.name == 'nt' and sys.version.find('mingw') >= 0 and self.debug: return apply(os.path.join, ext_path) + '_d' + so_ext return os.path.join(*ext_path) + so_ext @@ -704,6 +706,13 @@ class build_ext (Command): # to need it mentioned explicitly, though, so that's what we do. # Append '_d' to the python import library on debug builds. if sys.platform == "win32": + if os.name == 'nt' and sys.version.find('gcc') >= 0: + template = "python%d.%d.dll" + pythonlib = (template % + (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) + # don't extend ext.libraries, it may be shared with other + # extensions, it is a reference to the original list + return ext.libraries + [pythonlib] from distutils.msvccompiler import MSVCCompiler if not isinstance(self.compiler, MSVCCompiler): template = "python%d%d" diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index 94a7bd9..aec5fd3 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -78,6 +78,8 @@ def get_msvcr(): else: raise ValueError("Unknown MS Compiler version %i " % msc_Ver) + return [] + class CygwinCCompiler (UnixCCompiler): @@ -89,6 +91,10 @@ class CygwinCCompiler (UnixCCompiler): shared_lib_format = "%s%s" exe_extension = ".exe" + # FIXME: dylib_... = ".dll.a" is not enought for binutils + # loader on win32 platform !!! + dylib_lib_extension = ".dll.a" + def __init__ (self, verbose=0, dry_run=0, force=0): UnixCCompiler.__init__ (self, verbose, dry_run, force) @@ -126,7 +132,14 @@ class CygwinCCompiler (UnixCCompiler): shared_option = "-shared" else: shared_option = "-mdll -static" - + # Next line of code is problem for cross-compiled enviroment: + # NOTE: GCC cross-compiler is prefixed by the - + # and by default binaries are installed in same directory + # as native compiler. + + # FIXME: + # Hard-code may override unix-compiler settings and isn't + # possible to use Makefile variables to pass correct flags ! # Hard-code GCC because that's what this is all about. # XXX optimization, warnings etc. should be customizable. self.set_executables(compiler='gcc -mcygwin -O -Wall', @@ -159,6 +172,7 @@ class CygwinCCompiler (UnixCCompiler): except DistutilsExecError, msg: raise CompileError, msg else: # for other files use the C-compiler + try: self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + extra_postargs) @@ -271,8 +285,14 @@ class CygwinCCompiler (UnixCCompiler): if output_dir is None: output_dir = '' obj_names = [] for src_name in source_filenames: - # use normcase to make sure '.rc' is really '.rc' and not '.RC' - (base, ext) = os.path.splitext (os.path.normcase(src_name)) + # FIXME: "bogus checks for suffix" - as example the commented + # by #BOGUS# code break valid assembler suffix ".S" ! + #BOGUS## use normcase to make sure '.rc' is really '.rc' and not '.RC' + #BOGUS#(base, ext) = os.path.splitext (os.path.normcase(src_name)) + (base, ext) = os.path.splitext (src_name) + ext_normcase = os.path.normcase(ext) + if ext_normcase in ['.rc','.res']: + ext = ext_normcase if ext not in (self.src_extensions + ['.rc','.res']): raise UnknownFileError, \ "unknown file type '%s' (from '%s')" % \ diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 9993fba..f2be64b 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -161,7 +161,7 @@ def customize_compiler(compiler): Mainly needed on Unix, so we can plug in the information that varies across Unices and is stored in Python's Makefile. """ - if compiler.compiler_type == "unix": + if compiler.compiler_type in [ "unix", "mingw32"]: (cc, cxx, opt, cflags, ccshared, ldshared, so_ext) = \ get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'SO') @@ -450,10 +450,35 @@ def _init_nt(): g['VERSION'] = get_python_version().replace(".", "") g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable)) + # load the installed Makefile: + try: + filename = get_makefile_filename() + parse_makefile(filename, g) + except IOError, msg: + my_msg = "invalid Python installation: unable to open %s" % filename + if hasattr(msg, "strerror"): + my_msg = my_msg + " (%s)" % msg.strerror + + raise DistutilsPlatformError(my_msg) + + # load the installed pyconfig.h: + try: + prefix = EXEC_PREFIX + prefix = os.path.join(prefix, "PC") + filename = os.path.join(prefix, "pyconfig.h") + parse_config_h(file(filename), g) + except IOError, msg: + my_msg = "invalid Python installation: unable to open %s" % filename + if hasattr(msg, "strerror"): + my_msg = my_msg + " (%s)" % msg.strerror + + raise DistutilsPlatformError(my_msg) + global _config_vars _config_vars = g + def _init_mac(): """Initialize the module as appropriate for Macintosh systems""" g = {} @@ -493,6 +518,32 @@ def _init_os2(): g['SO'] = '.pyd' g['EXE'] = ".exe" + g['LDSHARED'] = "-lpython%s" % get_python_version() + + # load the installed Makefile: + try: + filename = get_makefile_filename() + parse_makefile(filename, g) + except IOError, msg: + my_msg = "invalid Python installation: unable to open %s" % filename + if hasattr(msg, "strerror"): + my_msg = my_msg + " (%s)" % msg.strerror + + raise DistutilsPlatformError(my_msg) + + # load the installed pyconfig.h: + try: + prefix = EXEC_PREFIX + prefix = os.path.join(prefix, "PC") + filename = os.path.join(prefix, "pyconfig.h") + parse_config_h(file(filename), g) + except IOError, msg: + my_msg = "invalid Python installation: unable to open %s" % filename + if hasattr(msg, "strerror"): + my_msg = my_msg + " (%s)" % msg.strerror + + raise DistutilsPlatformError(my_msg) + global _config_vars _config_vars = g diff --git a/Lib/lib2to3/tests/data/fixers/parrot_example.py b/Lib/lib2to3/tests/data/fixers/parrot_example.py index 0852928..2ebdf89 100644 --- a/Lib/lib2to3/tests/data/fixers/parrot_example.py +++ b/Lib/lib2to3/tests/data/fixers/parrot_example.py @@ -1,2 +1,2 @@ -def parrot(): - pass +def parrot(): + pass diff --git a/Makefile.pre.in b/Makefile.pre.in index e69157b..112b651 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -25,6 +25,7 @@ MODLIBS= _MODLIBS_ # === Variables set by configure VERSION= @VERSION@ +BYEBYEDOTVERSION= @BYEBYEDOTVERSION@ srcdir= @srcdir@ VPATH= @srcdir@ @@ -54,10 +55,14 @@ INSTALL_SHARED= ${INSTALL} -m 555 MAKESETUP= $(srcdir)/Modules/makesetup +WINEINCLUDES= @WINEINCLUDES@ +LIBWINE= @LIBWINE@ +win32build= @win32build@ + # Compiler options OPT= @OPT@ BASECFLAGS= @BASECFLAGS@ -CFLAGS= $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS) +CFLAGS= $(WINEINCLUDES) $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS) # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to # be able to build extension modules using the directories specified in the # environment variables @@ -66,11 +71,12 @@ LDFLAGS= @LDFLAGS@ LDLAST= @LDLAST@ SGI_ABI= @SGI_ABI@ CCSHARED= @CCSHARED@ +PYSPECFLAGS = @PYSPECFLAGS@ LINKFORSHARED= @LINKFORSHARED@ # Extra C flags added for building the interpreter object files. CFLAGSFORSHARED=@CFLAGSFORSHARED@ # C flags used for building the interpreter object files -PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE +PY_CFLAGS= $(PYSPECFLAGS) $(WINEINCLUDES) $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE # Machine-dependent subdirectories @@ -93,12 +99,15 @@ INCLUDEDIR= @includedir@ CONFINCLUDEDIR= $(exec_prefix)/include SCRIPTDIR= $(prefix)/lib +# Install suffix for detailed destination directories +INSTALLDESTSUFFIX = @INSTALLDESTSUFFIX@ + # Detailed destination directories -BINLIBDEST= $(LIBDIR)/python$(VERSION) -LIBDEST= $(SCRIPTDIR)/python$(VERSION) -INCLUDEPY= $(INCLUDEDIR)/python$(VERSION) -CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION) -LIBP= $(LIBDIR)/python$(VERSION) +BINLIBDEST= $(LIBDIR)$(INSTALLDESTSUFFIX) +LIBDEST= $(SCRIPTDIR)$(INSTALLDESTSUFFIX) +INCLUDEPY= $(INCLUDEDIR)$(INSTALLDESTSUFFIX) +CONFINCLUDEPY= $(CONFINCLUDEDIR)$(INSTALLDESTSUFFIX) +LIBP= $(LIBDIR)$(INSTALLDESTSUFFIX) # Symbols used for using shared libraries SO= @SO@ @@ -153,6 +162,8 @@ DIST= $(DISTFILES) $(DISTDIRS) LIBRARY= @LIBRARY@ LDLIBRARY= @LDLIBRARY@ +LDLIBRARYIMPLIB= @LDLIBRARYIMPLIB@ +LDLIBRARYIMPLIBDLLNAME= @LDLIBRARYIMPLIBDLLNAME@ BLDLIBRARY= @BLDLIBRARY@ DLLLIBRARY= @DLLLIBRARY@ LDLIBRARYDIR= @LDLIBRARYDIR@ @@ -169,13 +180,22 @@ THREADOBJ= @THREADOBJ@ DLINCLDIR= @DLINCLDIR@ DYNLOADFILE= @DYNLOADFILE@ MACHDEP_OBJS= @MACHDEP_OBJS@ +PYTHONWINE_OBJS= @PYTHONWINE_OBJS@ +PYTHONEXTRA_OBJS= @PYTHONEXTRA_OBJS@ +MODULEEXTRA_OBJS= @MODULEEXTRA_OBJS@ LIBOBJDIR= Python/ LIBOBJS= @LIBOBJS@ UNICODE_OBJS= @UNICODE_OBJS@ +GETPATH_OBJS= @GETPATH_OBJS@ PYTHON= python$(EXE) BUILDPYTHON= python$(BUILDEXE) +MSRTVER= @MSRTVER@ +PYTHONDLLMSVRES= @PYTHONDLLMSVRES@ +PYTHONEXEMSVRES= @PYTHONEXEMSVRES@ +PGENEXEMSVRES= @PGENEXEMSVRES@ + # The task to run while instrument when building the profile-opt target PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck #PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py @@ -186,8 +206,6 @@ PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck ########################################################################## # Modules MODULE_OBJS= \ - Modules/config.o \ - Modules/getpath.o \ Modules/main.o \ Modules/gcmodule.o @@ -259,7 +277,6 @@ PYTHON_OBJS= \ Python/codecs.o \ Python/errors.o \ Python/frozen.o \ - Python/frozenmain.o \ Python/future.o \ Python/getargs.o \ Python/getcompiler.o \ @@ -291,6 +308,8 @@ PYTHON_OBJS= \ Python/$(DYNLOADFILE) \ $(LIBOBJS) \ $(MACHDEP_OBJS) \ + $(PYTHONWINE_OBJS) \ + $(PYTHONEXTRA_OBJS) \ $(THREADOBJ) @@ -343,6 +362,8 @@ LIBRARY_OBJS= \ $(OBJECT_OBJS) \ $(PYTHON_OBJS) \ $(MODULE_OBJS) \ + $(MODULEEXTRA_OBJS) \ + $(GETPATH_OBJS) \ $(SIGNAL_OBJS) \ $(MODOBJS) @@ -380,11 +401,20 @@ coverage: $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov" +# This rule builds the .res file for the Python EXE, required when +# linking and using msvcrt80 or above. good luck to us all... +$(PYTHONEXEMSVRES): $(srcdir)/PC/python_$(VERSION)_$(MSRTVER)_mingw_exe.manifest \ + $(srcdir)/PC/python_$(VERSION)_$(MSRTVER)_mingw_exe.rc + windres --input $(srcdir)/PC/python_$(VERSION)_$(MSRTVER)_mingw_exe.rc \ + --output $(PYTHONEXEMSVRES) \ + --output-format=coff + # Build the interpreter -$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) - $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \ - Modules/python.o \ - $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) +$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) \ + $(DLLLIBRARY) $(PYTHONEXEMSVRES) + $(LINKCC) $(PYSPECFLAGS) $(LDFLAGS) $(LINKFORSHARED) -o $@ \ + Modules/python.o $(PYTHONEXEMSVRES) \ + $(BLDLIBRARY) $(LIBS) $(LIBWINE) $(MODLIBS) $(SYSLIBS) $(LDLAST) platform: $(BUILDPYTHON) $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform @@ -405,16 +435,16 @@ $(LIBRARY): $(LIBRARY_OBJS) $(AR) cr $@ $(PARSER_OBJS) $(AR) cr $@ $(OBJECT_OBJS) $(AR) cr $@ $(PYTHON_OBJS) - $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS) + $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS) $(GETPATH_OBJS) $(AR) cr $@ $(MODOBJS) $(RANLIB) $@ libpython$(VERSION).so: $(LIBRARY_OBJS) if test $(INSTSONAME) != $(LDLIBRARY); then \ - $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ + $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBWINE) $(LIBM) $(LDLAST); \ $(LN) -f $(INSTSONAME) $@; \ else \ - $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ + $(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBWINE) $(LIBM) $(LDLAST); \ fi libpython$(VERSION).dylib: $(LIBRARY_OBJS) @@ -452,13 +482,49 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \ $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources +# This rule builds the .res file for the Python DLL, required when +# linking and using msvcrt80 or above. good luck to us all... +$(PYTHONDLLMSVRES): $(srcdir)/PC/python_$(VERSION)_$(MSRTVER)_mingw_dll.manifest \ + $(srcdir)/PC/python_$(VERSION)_$(MSRTVER)_mingw_dll.rc + windres --input $(srcdir)/PC/python_$(VERSION)_$(MSRTVER)_mingw_dll.rc \ + --output $(PYTHONDLLMSVRES) \ + --output-format=coff + + # This rule builds the Cygwin Python DLL and import library if configured # for a shared core library; otherwise, this rule is a noop. -$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS) - if test -n "$(DLLLIBRARY)"; then \ - $(LDSHARED) $(LDFLAGS) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \ - $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \ - else true; \ +$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS) $(PYTHONDLLMSVRES) + if test -n "$(LIBWINE)"; then \ + if test -n "$(DLLLIBRARY)"; then \ + $(LDSHARED) -o $(DLLLIBRARY) $^ \ + $(LIBS) $(MODLIBS) $(LIBWINE) $(SYSLIBS) ;\ + else true; \ + fi \ + else\ + if test "$(win32build)" = "yes"; then \ + $(LDSHARED) $(PYSPECFLAGS) -o $(DLLLIBRARY) $^ \ + $(LIBS) $(MODLIBS) $(SYSLIBS) \ + $(PYTHONDLLMSVRES) ; \ + echo EXPORTS > python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' B _' | sed 's/.* B _//g' | grep "^__Py" >> python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' B _' | sed 's/.* B _//g' | grep "^_Py" >> python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' B _' | sed 's/.* B _//g' | grep "^Py" >> python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' R _' | sed 's/.* R _//g' | grep "^__Py" >> python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' R _' | sed 's/.* R _//g' | grep "^_Py" >> python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' D _' | sed 's/.* D _//g' | grep "^__Py" >> python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' D _' | sed 's/.* D _//g' | grep "^_Py" >> python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' D _' | sed 's/.* D _//g' | grep "^Py" >> python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' T _' | sed 's/.* T _//g' | grep "^init" >> python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' T _' | sed 's/.* T _//g' | grep "^_Py" >> python$(VERSION).def; \ + nm $(DLLLIBRARY) | grep ' T _' | sed 's/.* T _//g' | grep "^Py" >> python$(VERSION).def; \ + dlltool --def python$(VERSION).def --dllname $(DLLLIBRARY) \ + --output-lib $(LDLIBRARYIMPLIB); \ + rm -f $(LDLIBRARYIMPLIBDLLNAME); \ + $(LN) -s $(LDLIBRARYIMPLIB) $(LDLIBRARYIMPLIBDLLNAME); \ + else true; \ + $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \ + $(LIBS) $(MODLIBS) $(SYSLIBS); \ + fi \ fi @@ -497,11 +563,18 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \ $(OBJECT_OBJS) \ $(PYTHON_OBJS) \ $(MODULE_OBJS) \ + $(GETPATH_OBJS) \ $(SIGNAL_OBJS) \ $(MODOBJS) \ $(srcdir)/Modules/getbuildinfo.c $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c +Modules/zlibmodule.o: $(srcdir)/Modules/zlibmodule.c Makefile + -@ mkdir -p Modules/zlib + $(CC) -c $(PY_CFLAGS) \ + -I$(srcdir)/Modules/zlib \ + -o $@ $(srcdir)/Modules/zlibmodule.c + Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \ -DPREFIX='"$(prefix)"' \ @@ -518,8 +591,17 @@ $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) -@$(INSTALL) -d Include -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) -$(PGEN): $(PGENOBJS) - $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) +# This rule builds the .res file for the PGEN EXE, required when +# linking and using msvcrt80 or above. good luck to us all... +$(PGENEXEMSVRES): $(srcdir)/PC/pgen_$(VERSION)_$(MSRTVER)_mingw_exe.manifest \ + $(srcdir)/PC/pgen_$(VERSION)_$(MSRTVER)_mingw_exe.rc + windres --input $(srcdir)/PC/pgen_$(VERSION)_$(MSRTVER)_mingw_exe.rc \ + --output $(PGENEXEMSVRES) \ + --output-format=coff + +$(PGEN): $(PGENOBJS) $(PGENEXEMSVRES) + $(CC) $(PYSPECFLAGS) $(OPT) $(LDFLAGS) $(PGENEXEMSVRES) \ + $(PGENOBJS) $(LIBS) -o $(PGEN) Parser/grammar.o: $(srcdir)/Parser/grammar.c \ $(srcdir)/Include/token.h \ @@ -541,6 +623,12 @@ Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H) Python/getplatform.o: $(srcdir)/Python/getplatform.c $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c +PC/import_nt.o: $(srcdir)/PC/import_nt.c + $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -I$(srcdir)/Python -o $@ $(srcdir)/PC/import_nt.c + +PC/dl_nt.o: $(srcdir)/PC/dl_nt.c + $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/PC/dl_nt.c + Python/importdl.o: $(srcdir)/Python/importdl.c $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c diff --git a/Misc/python.man b/Misc/python.man index 56d57f4..0f21952 100644 --- a/Misc/python.man +++ b/Misc/python.man @@ -1,8 +1,5 @@ .TH PYTHON "1" "$Date$" -./" To view this file while editing, run it through groff: -./" groff -Tascii -man python.man | less - .SH NAME python \- an interpreted, interactive, object-oriented programming language .SH SYNOPSIS diff --git a/Modules/Setup.config.in b/Modules/Setup.config.in index fed62e9..09b20ea 100644 --- a/Modules/Setup.config.in +++ b/Modules/Setup.config.in @@ -3,11 +3,36 @@ # The purpose of this file is to conditionally enable certain modules # based on configure-time options. +# init system calls(posix/nt/...) for INITFUNC (used by makesetup) +@INITSYS@ posixmodule.c + # Threading @USE_THREAD_MODULE@thread threadmodule.c # The signal module @USE_SIGNAL_MODULE@signal signalmodule.c +# pwd module. setup.py detects this and compiles it: what's it doing in here? +@USE_PWD_MODULE@pwd pwdmodule.c # this is needed to find out the user's home dir + +# On win32 host(mingw build in MSYS environment) show that site.py +# fail to load if some modules are not build-in: +@BUILDIN_WIN32_MODULE@_functools _functoolsmodule.c # Tools for working with functions and callable objects +@BUILDIN_WIN32_MODULE@operator operator.c # operator.add() and similar goodies +@BUILDIN_WIN32_MODULE@_locale _localemodule.c # -lintl +@BUILDIN_WIN32_MODULE@_winreg ../PC/_winreg.c + +# On wine host (ming build in MSYS environment with MSVCR80) +# some modules crash or hang if not built-in +@BUILDIN_WIN32_MODULE@_struct _struct.c +@BUILDIN_WIN32_MODULE@_subprocess ../PC/_subprocess.c +@BUILDIN_WIN32_MODULE@_collections _collectionsmodule.c +@BUILDIN_WIN32_MODULE@array arraymodule.c +@BUILDIN_WIN32_MODULE@_weakref _weakref.c +@BUILDIN_WIN32_MODULE@gc gcmodule.c +# done only if -lbz2 detected +@BUILDIN_BZ2_MODULE@bz2 bz2module.c # -lbz2 + # The rest of the modules previously listed in this file are built # by the setup.py script in Python 2.1 and later. + diff --git a/Modules/Setup.dist b/Modules/Setup.dist index 5e69a60..ad92841 100644 --- a/Modules/Setup.dist +++ b/Modules/Setup.dist @@ -112,7 +112,6 @@ PYTHONPATH=$(COREPYTHONPATH) # This only contains the minimal set of modules required to run the # setup.py script in the root of the Python source tree. -posix posixmodule.c # posix (UNIX) system calls errno errnomodule.c # posix (UNIX) errno values pwd pwdmodule.c # this is needed to find out the user's home dir # if $HOME is not set diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index a509d4b..dc9fe36 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -600,7 +600,7 @@ CDataType_in_dll(PyObject *type, PyObject *args) address = (void *)ctypes_dlsym(handle, name); if (!address) { PyErr_Format(PyExc_ValueError, -#ifdef __CYGWIN__ +#if defined(__CYGWIN__) || defined(__MINGW32__) /* dlerror() isn't very helpful on cygwin */ "symbol '%s' not found (%s) ", name, diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c index 3f13180..3b6dab3 100644 --- a/Modules/_ctypes/_ctypes_test.c +++ b/Modules/_ctypes/_ctypes_test.c @@ -17,7 +17,7 @@ #include #endif -#if defined(MS_WIN32) || defined(__CYGWIN__) +#if defined(MS_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) #define EXPORT(x) __declspec(dllexport) x #else #define EXPORT(x) x diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 7f7d641..effa012 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -715,7 +715,7 @@ ffi_type *GetType(PyObject *obj) dict = PyType_stgdict(obj); if (dict == NULL) return &ffi_type_sint; -#if defined(MS_WIN32) && !defined(_WIN32_WCE) +#if defined(MS_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__) /* This little trick works correctly with MSVC. It returns small structures in registers */ diff --git a/Modules/cPickle.c b/Modules/cPickle.c index 7f836c3..c2879d1 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -3269,7 +3269,15 @@ load_int(Unpicklerobject *self) errno = 0; l = strtol(s, &endptr, 0); - if (errno || (*endptr != '\n') || (endptr[1] != '\0')) { + if (errno || (*endptr != '\n') || (endptr[1] != '\0') +#if defined(__MINGW32__) && (SIZEOF_LONG == 4) + /* integers of 10 chars or over could be bigger than 32-bit. + * just keep it simple: 10 or more chars, it goes into + * a PyLong. + */ + || (len >= 10) +#endif + ) { /* Hm, maybe we've got something long. Let's try reading it as a Python long object. */ errno = 0; diff --git a/Modules/main.c b/Modules/main.c index 6ed2cd7..bd6610b 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -9,7 +9,7 @@ #include #endif -#if defined(MS_WINDOWS) || defined(__CYGWIN__) +#if defined(MS_WINDOWS) || defined(__CYGWIN__) || defined(__MINGW32__) #ifdef HAVE_FCNTL_H #include #endif @@ -430,6 +430,23 @@ Py_Main(int argc, char **argv) return 0; } +#if defined(__MINGW32__) + /* something weird with interactive flag - unless interactive + * flag is set when python is _supposed_ to be running in + * interactive mode, Py_FdIsInteractive(stdin) returns FALSE. + * so, we detect no command, no module, no filename, no further + * arguments, or the last argument is "-" as "interactive" + */ + if (command == NULL && module == NULL && /* no command, no module */ + ((_PyOS_optind == argc) || /* no args left - definitely interactive */ + ((_PyOS_optind < argc-1) && + strcmp(argv[_PyOS_optind], "-") == 0) /* current arg = '-' */ + )) + { + Py_InteractiveFlag++; + } +#endif + if (!Py_InspectFlag && (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0') Py_InspectFlag = 1; @@ -507,6 +524,7 @@ Py_Main(int argc, char **argv) #else Py_SetProgramName(argv[0]); #endif + Py_Initialize(); if (Py_VerboseFlag || diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index cda8135..8d8f301 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -30,6 +30,10 @@ #include "Python.h" #include "structseq.h" +#if defined(__WINE__) || defined(__MINGW32__) +#include +#endif + #if defined(__VMS) # include #endif /* defined(__VMS) */ @@ -103,7 +107,9 @@ corresponding Unix manual entries for more information on calls."); #else #if defined(__WATCOMC__) && !defined(__QNX__) /* Watcom compiler */ #define HAVE_GETCWD 1 +#ifndef __WINE__ #define HAVE_OPENDIR 1 +#endif #define HAVE_SYSTEM 1 #if defined(__OS2__) #define HAVE_EXECV 1 @@ -120,7 +126,7 @@ corresponding Unix manual entries for more information on calls."); #define HAVE_SYSTEM 1 #define HAVE_WAIT 1 #else -#ifdef _MSC_VER /* Microsoft compiler */ +#if defined(_MSC_VER) || defined(__MINGW32__) /* Microsoft / MingW32 compiler */ #define HAVE_GETCWD 1 #define HAVE_SPAWNV 1 #define HAVE_EXECV 1 @@ -147,7 +153,9 @@ corresponding Unix manual entries for more information on calls."); #define HAVE_GETPPID 1 #define HAVE_GETUID 1 #define HAVE_KILL 1 +#if !defined( __WINE__) && !defined(__MINGW32__) #define HAVE_OPENDIR 1 +#endif #define HAVE_PIPE 1 #ifndef __rtems__ #define HAVE_POPEN 1 @@ -156,7 +164,7 @@ corresponding Unix manual entries for more information on calls."); #define HAVE_WAIT 1 #define HAVE_TTYNAME 1 #endif /* PYOS_OS2 && PYCC_GCC && __VMS */ -#endif /* _MSC_VER */ +#endif /* _MSC_VER / MINGW32 */ #endif /* __BORLANDC__ */ #endif /* ! __WATCOMC__ || __QNX__ */ #endif /* ! __IBMC__ */ @@ -176,17 +184,21 @@ extern int mkdir(char *); #if ( defined(__WATCOMC__) || defined(_MSC_VER) ) && !defined(__QNX__) extern int mkdir(const char *); #else +#if !defined( __WINE__) && !defined(__MINGW32__) extern int mkdir(const char *, mode_t); #endif #endif +#endif #if defined(__IBMC__) || defined(__IBMCPP__) extern int chdir(char *); extern int rmdir(char *); #else +#if !defined( __WINE__) && !defined(__MINGW32__) extern int chdir(const char *); extern int rmdir(const char *); #endif -#ifdef __BORLANDC__ +#endif +#if defined(__BORLANDC__) || defined(__WINE__) || defined(__MINGW32__) extern int chmod(const char *, int); #else extern int chmod(const char *, mode_t); @@ -197,8 +209,12 @@ extern int fchmod(int, mode_t); /*#ifdef HAVE_LCHMOD extern int lchmod(const char *, mode_t); #endif*/ +#ifdef HAVE_CHOWN extern int chown(const char *, uid_t, gid_t); +#endif +#if !defined( __WINE__) && !defined(__MINGW32__) extern char *getcwd(char *, int); +#endif extern char *strerror(int); extern int link(const char *, const char *); extern int rename(const char *, const char *); @@ -258,7 +274,7 @@ extern int lstat(const char *, struct stat *); #endif #endif -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__WINE__) || defined(__MINGW32__) #ifdef HAVE_DIRECT_H #include #endif @@ -270,10 +286,11 @@ extern int lstat(const char *, struct stat *); #endif #include "osdefs.h" #include +#include #include /* for ShellExecute() */ #define popen _popen #define pclose _pclose -#endif /* _MSC_VER */ +#endif /* _MSC_VER / WINE / MINGW32 */ #if defined(PYCC_VACPP) && defined(PYOS_OS2) #include @@ -2482,7 +2499,7 @@ posix_mkdir(PyObject *self, PyObject *args) Py_FileSystemDefaultEncoding, &path, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS -#if ( defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__) +#if ( defined(__MINGW32__) || defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__) res = mkdir(path); #else res = mkdir(path, mode); @@ -3192,7 +3209,7 @@ posix_spawnv(PyObject *self, PyObject *args) } argvlist[argc] = NULL; -#if defined(PYOS_OS2) && defined(PYCC_GCC) +#if defined(__WINE__) || (defined(PYOS_OS2) && defined(PYCC_GCC)) || defined(__MINGW32__) Py_BEGIN_ALLOW_THREADS spawnval = spawnv(mode, path, argvlist); Py_END_ALLOW_THREADS @@ -3337,7 +3354,7 @@ posix_spawnve(PyObject *self, PyObject *args) } envlist[envc] = 0; -#if defined(PYOS_OS2) && defined(PYCC_GCC) +#if defined(__WINE__) || (defined(PYOS_OS2) && defined(PYCC_GCC)) || defined(__MINGW32__) Py_BEGIN_ALLOW_THREADS spawnval = spawnve(mode, path, argvlist, envlist); Py_END_ALLOW_THREADS @@ -3646,7 +3663,7 @@ posix_fork(PyObject *self, PyObject *noargs) #define DEV_PTY_FILE "/dev/ptmx" #endif -#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX) +#if !defined(__MINGW32__) && (defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX)) #ifdef HAVE_PTY_H #include #else @@ -3659,7 +3676,7 @@ posix_fork(PyObject *self, PyObject *noargs) #endif #endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX */ -#if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) +#if !defined(__MINGW32__) && (defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX)) PyDoc_STRVAR(posix_openpty__doc__, "openpty() -> (master_fd, slave_fd)\n\n\ Open a pseudo-terminal, returning open fd's for both master and slave end.\n"); @@ -8889,7 +8906,11 @@ all_ins(PyObject *d) #else if (ins(d, "P_WAIT", (long)_P_WAIT)) return -1; if (ins(d, "P_NOWAIT", (long)_P_NOWAIT)) return -1; +#ifdef _OLD_P_OVERLAY if (ins(d, "P_OVERLAY", (long)_OLD_P_OVERLAY)) return -1; +#else + if (ins(d, "P_OVERLAY", (long)_P_OVERLAY)) return -1; +#endif if (ins(d, "P_NOWAITO", (long)_P_NOWAITO)) return -1; if (ins(d, "P_DETACH", (long)_P_DETACH)) return -1; #endif @@ -8902,7 +8923,7 @@ all_ins(PyObject *d) } -#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__) +#if (defined(__MINGW32__) || defined(__WINE__) || defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__) #define INITFUNC initnt #define MODNAME "nt" @@ -9020,3 +9041,4 @@ INITFUNC(void) #endif + diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index 9e01f48..e8c938d 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -5,6 +5,7 @@ #include "structseq.h" #include +#ifndef __MINGW32__ #include static PyStructSequence_Field struct_pwd_type_fields[] = { @@ -31,6 +32,8 @@ static PyStructSequence_Desc struct_pwd_type_desc = { 7, }; +#endif + PyDoc_STRVAR(pwd__doc__, "This module provides access to the Unix password database.\n\ It is available on all Unix versions.\n\ @@ -43,6 +46,7 @@ exception is raised if the entry asked for cannot be found."); static int initialized; +#ifndef __MINGW32__ static PyTypeObject StructPwdType; static void @@ -100,6 +104,7 @@ PyDoc_STRVAR(pwd_getpwuid__doc__, Return the password database entry for the given numeric user ID.\n\ See pwd.__doc__ for more on password database entries."); + static PyObject * pwd_getpwuid(PyObject *self, PyObject *args) { @@ -169,13 +174,17 @@ pwd_getpwall(PyObject *self) } #endif +#endif + static PyMethodDef pwd_methods[] = { +#ifndef __MINGW32__ {"getpwuid", pwd_getpwuid, METH_VARARGS, pwd_getpwuid__doc__}, {"getpwnam", pwd_getpwnam, METH_VARARGS, pwd_getpwnam__doc__}, #ifdef HAVE_GETPWENT {"getpwall", (PyCFunction)pwd_getpwall, METH_NOARGS, pwd_getpwall__doc__}, #endif +#endif {NULL, NULL} /* sentinel */ }; @@ -187,6 +196,7 @@ initpwd(void) if (m == NULL) return; +#ifndef __MINGW32__ if (!initialized) PyStructSequence_InitType(&StructPwdType, &struct_pwd_type_desc); @@ -194,5 +204,6 @@ initpwd(void) PyModule_AddObject(m, "struct_passwd", (PyObject *) &StructPwdType); /* And for b/w compatibility (this was defined by mistake): */ PyModule_AddObject(m, "struct_pwent", (PyObject *) &StructPwdType); +#endif initialized = 1; } diff --git a/Modules/python.c b/Modules/python.c index 2739b8b..f241118 100644 --- a/Modules/python.c +++ b/Modules/python.c @@ -20,5 +20,6 @@ main(int argc, char **argv) m = fpgetmask(); fpsetmask(m & ~FP_X_OFL); #endif + return Py_Main(argc, argv); } diff --git a/Modules/rotatingtree.h b/Modules/rotatingtree.h index 3aa0986..7901917 100644 --- a/Modules/rotatingtree.h +++ b/Modules/rotatingtree.h @@ -8,6 +8,7 @@ * and over again, and this set of keys evolves slowly over time. */ +#include #include #define EMPTY_ROTATING_TREE ((rotating_node_t *)NULL) diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 2638bdc..d81131b 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -21,10 +21,17 @@ Here we boost it. Users who want even more than the boosted limit should #define FD_SETSIZE higher before this; e.g., via compiler /D switch. + + Compiled on MingW32, running under MSYS / rxvt.exe, even 512 is too + small. */ #if defined(MS_WINDOWS) && !defined(FD_SETSIZE) +#ifdef __MINGW32__ +#define FD_SETSIZE 1024 +#else #define FD_SETSIZE 512 #endif +#endif #if defined(HAVE_POLL_H) #include diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index d5d80c5..9185680 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -82,6 +82,12 @@ static struct { static sig_atomic_t wakeup_fd = -1; +#ifdef __WINE__ +/* wine's signal.h doesn't define sig_atomic_t + */ +typedef int sig_atomic_t; +#endif + /* Speed up sigcheck() when none tripped */ static volatile sig_atomic_t is_tripped = 0; diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index ef8d0fc..e3f5ef8 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -20,13 +20,24 @@ * any version information. * I use SIO_GET_MULTICAST_FILTER to detect a decent SDK. */ -# ifdef SIO_GET_MULTICAST_FILTER +# if defined(SIO_GET_MULTICAST_FILTER) || defined(__MINGW32__) +# if !defined(__MINGW32__) # include /* for SIO_RCVALL */ -# define HAVE_ADDRINFO -# define HAVE_SOCKADDR_STORAGE +#else +#ifndef SIO_RCVALL +#define SIO_RCVALL _WSAIOW(IOC_VENDOR, 1) +#define RCVALL_OFF 0 +#define RCVALL_ON 1 +#define RCVALL_SOCKETLEVELONLY 2 +#endif +#endif +#if (_WIN32_WINNT >= 0x501) # define HAVE_GETADDRINFO # define HAVE_GETNAMEINFO # define ENABLE_IPV6 +#endif +# define HAVE_ADDRINFO +# define HAVE_SOCKADDR_STORAGE # else typedef int socklen_t; # endif /* IPPROTO_IPV6 */ diff --git a/Modules/zlib/minigzip.c b/Modules/zlib/minigzip.c index 4524b96..eb9d12d 100644 --- a/Modules/zlib/minigzip.c +++ b/Modules/zlib/minigzip.c @@ -20,6 +20,7 @@ #ifdef STDC # include +# include # include #endif diff --git a/Modules/zlib/zutil.h b/Modules/zlib/zutil.h index b7d5eff..19bdf15 100644 --- a/Modules/zlib/zutil.h +++ b/Modules/zlib/zutil.h @@ -21,6 +21,7 @@ # include # endif # include +# include # include #endif #ifdef NO_ERRNO_H diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 99cfb2b..62ef8dc 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -791,7 +791,7 @@ MiddlingExtendsException(PyExc_EnvironmentError, OSError, /* * WindowsError extends OSError */ -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__WINE__) || defined(__MINGW32__) #include "errmap.h" static int @@ -2012,7 +2012,7 @@ _PyExc_Init(void) PRE_INIT(EnvironmentError) PRE_INIT(IOError) PRE_INIT(OSError) -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__WINE__) || defined(__MINGW32__) PRE_INIT(WindowsError) #endif #ifdef __VMS @@ -2080,7 +2080,7 @@ _PyExc_Init(void) POST_INIT(EnvironmentError) POST_INIT(IOError) POST_INIT(OSError) -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__WINE__) || defined(__MINGW32__) POST_INIT(WindowsError) #endif #ifdef __VMS diff --git a/Objects/fileobject.c b/Objects/fileobject.c index e01f38e..96dd0f0 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -37,6 +37,14 @@ #define FLOCKFILE(f) flockfile(f) #define FUNLOCKFILE(f) funlockfile(f) #else +#if defined(__MINGW32__) && !defined(_MT) +/* running under wine, there's a bug in MSVCRT_filbuf which + * doesn't perform crlf conversion, bug MSVCRT_getc does. + * http://bugs.winehq.org/show_bug.cgi?id=16970 + */ +#error bug in wine: please recompile enabling multithreading +#error (add -mthreads to BASECFLAGS and LDFLAGS) +#endif /* __MINGW32__ && !_MT */ #define GETC(f) getc(f) #define FLOCKFILE(f) #define FUNLOCKFILE(f) diff --git a/PC/_msi.c b/PC/_msi.c index 58b2530..9d68ba7 100644 --- a/PC/_msi.c +++ b/PC/_msi.c @@ -4,9 +4,9 @@ */ #include -#include #include #include +#include #include #include #include diff --git a/PC/_winreg.c b/PC/_winreg.c index 0cb516a..abb306c 100644 --- a/PC/_winreg.c +++ b/PC/_winreg.c @@ -17,6 +17,18 @@ #include "malloc.h" /* for alloca */ #include "windows.h" +#if defined(__MINGW32__) +_CRTIMP size_t __cdecl __MINGW_NOTHROW _mbstrlen(const char *s); +#endif + +#if !defined(REG_LEGAL_CHANGE_FILTER) +#define REG_LEGAL_CHANGE_FILTER \ + (REG_NOTIFY_CHANGE_NAME |\ + REG_NOTIFY_CHANGE_ATTRIBUTES |\ + REG_NOTIFY_CHANGE_LAST_SET |\ + REG_NOTIFY_CHANGE_SECURITY) +#endif + static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK); static PyObject *PyHKEY_FromHKEY(HKEY h); static BOOL PyHKEY_Close(PyObject *obHandle); @@ -1689,7 +1701,9 @@ PyMODINIT_FUNC init_winreg(void) ADD_INT(REG_NOTIFY_CHANGE_ATTRIBUTES); ADD_INT(REG_NOTIFY_CHANGE_LAST_SET); ADD_INT(REG_NOTIFY_CHANGE_SECURITY); +#ifdef REG_LEGAL_CHANGE_FILTER ADD_INT(REG_LEGAL_CHANGE_FILTER); +#endif ADD_INT(REG_NONE); ADD_INT(REG_SZ); ADD_INT(REG_EXPAND_SZ); diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index cad22b1..5c580b9 100755 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -28,6 +28,31 @@ #endif #endif +#if defined(__MINGW32__) +#if __MSVCRT_VERSION__ >= 0x0700 +# define _WCONIO_DEFINED +/* NOTE: Up to version ?.?? mingw don't define functions + * listed below. Also it require module to be linked with + * ms-vcrt at least verion 7. + * To build with different runtimes see: + * http://www.mingw.org/wiki/HOWTO_Use_the_GCC_specs_file + * + * Also note that NT5.1(XP), shiped with msvcrt version 7.0, + * contain all those functions, but library name is msvcrt.dll. + * So if you like module to run on w2k as is you must define + * appropriate __MSVCRT_VERSION__ . + * If you like those functions even on w2k you must link + * with appropriate runtime and to pack it in distributions. + * This is what native build do - it is build and packed + * with version 9.0 of Microsoft C-runtime. + */ +_CRTIMP wint_t __cdecl __MINGW_NOTHROW _getwch (void); +_CRTIMP wint_t __cdecl __MINGW_NOTHROW _getwche (void); +_CRTIMP wint_t __cdecl __MINGW_NOTHROW _putwch (wchar_t); +_CRTIMP wint_t __cdecl __MINGW_NOTHROW _ungetwch(wint_t); +#endif /* __MSVCRT_VERSION__ >= 0x0700 */ +#endif + // Force the malloc heap to clean itself up, and free unused blocks // back to the OS. (According to the docs, only works on NT.) static PyObject * diff --git a/PC/pgen_2.5_8.0_exe.manifest b/PC/pgen_2.5_8.0_exe.manifest new file mode 100644 index 0000000..c43197c --- /dev/null +++ b/PC/pgen_2.5_8.0_exe.manifest @@ -0,0 +1,6 @@ + + + n9On8FItNsK/DmT8UQxu6jYDtWQ= + 0KJ/VTwP4OUHx98HlIW2AdW1kuY= + YJuB+9Os2oxW4mY+2oC/r8lICZE= + diff --git a/PC/pgen_2.5_8.0_mingw_exe.manifest b/PC/pgen_2.5_8.0_mingw_exe.manifest new file mode 100644 index 0000000..5eee77c --- /dev/null +++ b/PC/pgen_2.5_8.0_mingw_exe.manifest @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/PC/pgen_2.5_8.0_mingw_exe.rc b/PC/pgen_2.5_8.0_mingw_exe.rc new file mode 100644 index 0000000..8ddd172 --- /dev/null +++ b/PC/pgen_2.5_8.0_mingw_exe.rc @@ -0,0 +1,2 @@ +#include "winuser.h" +2 RT_MANIFEST PC/pgen_2.5_8.0_mingw_exe.manifest diff --git a/PC/pgen_2.5_9.0_mingw_exe.manifest b/PC/pgen_2.5_9.0_mingw_exe.manifest new file mode 100644 index 0000000..9d71d46 --- /dev/null +++ b/PC/pgen_2.5_9.0_mingw_exe.manifest @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/PC/pgen_2.5_9.0_mingw_exe.rc b/PC/pgen_2.5_9.0_mingw_exe.rc new file mode 100644 index 0000000..5ca5152 --- /dev/null +++ b/PC/pgen_2.5_9.0_mingw_exe.rc @@ -0,0 +1,2 @@ +#include "winuser.h" +2 RT_MANIFEST PC/python_2.5_9.0.manifest diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 3719586..05810cc 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -74,16 +74,22 @@ WIN32 is still required for the locale module. #define DONT_HAVE_SIG_PAUSE #define LONG_BIT 32 #define WORD_BIT 32 + +/* only define PREFIX when building the core - pyexpat module has a + * typedef for "PREFIX" which this conflicts with otherwise */ +#if defined(__MINGW32__) && defined(Py_BUILD_CORE) #define PREFIX "" #define EXEC_PREFIX "" +#endif + #define MS_WIN32 /* only support win32 and greater. */ #define MS_WINDOWS #ifndef PYTHONPATH # define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk" #endif #define NT_THREADS -#define WITH_THREAD +#define WITH_THREAD 1 #ifndef NETSCAPE_PI #define USE_SOCKET #endif @@ -110,7 +116,7 @@ WIN32 is still required for the locale module. /* ------------------------------------------------------------------------*/ /* Microsoft C defines _MSC_VER */ -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__WINE__) || defined(__MINGW32__) /* We want COMPILER to expand to a string containing _MSC_VER's *value*. * This is horridly tricky, because the stringization operator only works @@ -200,14 +206,29 @@ WIN32 is still required for the locale module. #define _W64 #endif +#if defined(__MINGW32__) +#define HAVE_MEMMOVE 1 +#define HAVE_SNPRINTF 1 +#endif + /* Define like size_t, omitting the "unsigned" */ +#if defined(__MINGW32__) +#include +#include +#else +#if defined(__WINE__) +#define _SSIZE_T_DEFINED +#endif #ifdef MS_WIN64 typedef __int64 ssize_t; #else typedef _W64 int ssize_t; #endif +#endif #define HAVE_SSIZE_T 1 + +#if !defined(__MINGW32__) #if defined(MS_WIN32) && !defined(MS_WIN64) #ifdef _M_IX86 #define COMPILER _Py_PASTE_VERSION("32 bit (Intel)") @@ -215,8 +236,15 @@ typedef _W64 int ssize_t; #define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)") #endif #endif /* MS_WIN32 && !MS_WIN64 */ +#endif +#if defined(__WINE__) || defined(__MINGW32__) +#define _PID_T_DEFINED +#endif +#ifndef _PID_T_ +#define _PID_T_ typedef int pid_t; +#endif #include #define Py_IS_NAN _isnan @@ -275,7 +303,11 @@ typedef int pid_t; #warning "Please use an up-to-date version of gcc! (>2.91 recommended)" #endif +#if defined(__MINGW32__) +#define COMPILER "[gcc-mingw32]" +#else #define COMPILER "[gcc]" +#endif /* __MINGW32__ */ #define hypot _hypot #define PY_LONG_LONG long long #define PY_LLONG_MIN LLONG_MIN @@ -384,6 +416,11 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ #define SIZEOF_DOUBLE 8 #define SIZEOF_FLOAT 4 +#if defined(__WINE__) || defined(__MINGW32__) +#define HAVE_UINTPTR_T 1 +#define HAVE_INTPTR_T 1 +#endif + /* VC 7.1 has them and VC 6.0 does not. VC 6.0 has a version number of 1200. Microsoft eMbedded Visual C++ 4.0 has a version number of 1201 and doesn't define these. @@ -516,9 +553,6 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ /* Define if you want documentation strings in extension modules */ #define WITH_DOC_STRINGS 1 -/* Define if you want to compile in rudimentary thread support */ -/* #undef WITH_THREAD */ - /* Define if you want to use the GNU readline library */ /* #define WITH_READLINE 1 */ @@ -723,4 +757,14 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ socket handles greater than FD_SETSIZE */ #define Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE +#ifdef __WINE__ +/* This is used to fool distutils into noticing the difference + * between wine and msvc. otherwise, setup.py (distutils) tries + * to use MSVCCompiler, on linux. + */ +#define HAVE_WINE 1 + +#define HAVE_SPAWNV +#endif + #endif /* !Py_CONFIG_H */ diff --git a/PC/python_2.5_8.0_exe.manifest b/PC/python_2.5_8.0_exe.manifest new file mode 100644 index 0000000..5eee77c --- /dev/null +++ b/PC/python_2.5_8.0_exe.manifest @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/PC/python_2.5_8.0_mingw_dll.manifest b/PC/python_2.5_8.0_mingw_dll.manifest new file mode 100644 index 0000000..5eee77c --- /dev/null +++ b/PC/python_2.5_8.0_mingw_dll.manifest @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/PC/python_2.5_8.0_mingw_dll.rc b/PC/python_2.5_8.0_mingw_dll.rc new file mode 100644 index 0000000..686c6c8 --- /dev/null +++ b/PC/python_2.5_8.0_mingw_dll.rc @@ -0,0 +1,2 @@ +#include "winuser.h" +2 RT_MANIFEST PC/python_2.5_8.0_mingw_dll.manifest diff --git a/PC/python_2.5_8.0_mingw_exe.manifest b/PC/python_2.5_8.0_mingw_exe.manifest new file mode 100644 index 0000000..5eee77c --- /dev/null +++ b/PC/python_2.5_8.0_mingw_exe.manifest @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/PC/python_2.5_8.0_mingw_exe.rc b/PC/python_2.5_8.0_mingw_exe.rc new file mode 100644 index 0000000..9894f17 --- /dev/null +++ b/PC/python_2.5_8.0_mingw_exe.rc @@ -0,0 +1,2 @@ +#include "winuser.h" +2 RT_MANIFEST PC/python_2.5_8.0_mingw_exe.manifest diff --git a/PC/python_2.5_9.0.manifest b/PC/python_2.5_9.0.manifest new file mode 100644 index 0000000..9d71d46 --- /dev/null +++ b/PC/python_2.5_9.0.manifest @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/PC/python_2.5_9.0_mingw_dll.manifest b/PC/python_2.5_9.0_mingw_dll.manifest new file mode 100644 index 0000000..9d71d46 --- /dev/null +++ b/PC/python_2.5_9.0_mingw_dll.manifest @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/PC/python_2.5_9.0_mingw_dll.rc b/PC/python_2.5_9.0_mingw_dll.rc new file mode 100644 index 0000000..937448d --- /dev/null +++ b/PC/python_2.5_9.0_mingw_dll.rc @@ -0,0 +1,2 @@ +#include "winuser.h" +2 RT_MANIFEST PC/python_2.5_9.0_mingw_dll.manifest diff --git a/PC/python_2.5_9.0_mingw_exe.manifest b/PC/python_2.5_9.0_mingw_exe.manifest new file mode 100644 index 0000000..9d71d46 --- /dev/null +++ b/PC/python_2.5_9.0_mingw_exe.manifest @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/PC/python_2.5_9.0_mingw_exe.rc b/PC/python_2.5_9.0_mingw_exe.rc new file mode 100644 index 0000000..4f27b9b --- /dev/null +++ b/PC/python_2.5_9.0_mingw_exe.rc @@ -0,0 +1,2 @@ +#include "winuser.h" +2 RT_MANIFEST PC/python_2.5_9.0_mingw_exe.manifest diff --git a/PC/python_dll.manifest b/PC/python_dll.manifest new file mode 100644 index 0000000..d949987 --- /dev/null +++ b/PC/python_dll.manifest @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Python/dynload_win.c b/Python/dynload_win.c index 7c71d9c..67ae0df 100644 --- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -24,7 +24,7 @@ const struct filedescr _PyImport_DynLoadFiletab[] = { /* Case insensitive string compare, to avoid any dependencies on particular C RTL implementations */ -static int strcasecmp (char *string1, char *string2) +static int _strcasecmp (char *string1, char *string2) { int first, second; @@ -249,7 +249,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, import_python = GetPythonImport(hDLL); if (import_python && - strcasecmp(buffer,import_python)) { + _strcasecmp(buffer,import_python)) { PyOS_snprintf(buffer, sizeof(buffer), "Module use of %.150s conflicts " "with this version of Python.", diff --git a/Python/errors.c b/Python/errors.c index c88a190..7adbef2 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -9,7 +9,7 @@ extern char *strerror(int); #endif #endif -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__WINE__) || defined(__MINGW32__) #include "windows.h" #include "winbase.h" #endif @@ -276,6 +276,14 @@ PyErr_NoMemory(void) return NULL; } +#ifdef __WINE__ +/* whoops - wine doesn't provide direct access in stdlib.h to + * these msvcr71 variables + */ +extern int _sys_nerr; +extern char** _sys_errlist; +#endif + PyObject * PyErr_SetFromErrnoWithFilenameObject(PyObject *exc, PyObject *filenameObject) { @@ -285,7 +293,7 @@ PyErr_SetFromErrnoWithFilenameObject(PyObject *exc, PyObject *filenameObject) #ifdef PLAN9 char errbuf[ERRMAX]; #endif -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__WINE__) || defined(__MINGW32__) char *s_buf = NULL; char s_small_buf[28]; /* Room for "Windows Error 0xFFFFFFFF" */ #endif @@ -300,7 +308,7 @@ PyErr_SetFromErrnoWithFilenameObject(PyObject *exc, PyObject *filenameObject) if (i == 0) s = "Error"; /* Sometimes errno didn't get set */ else -#ifndef MS_WINDOWS +#if !defined(MS_WINDOWS) && !defined(__WINE__) || defined(__MINGW32__) s = strerror(i); #else { @@ -349,7 +357,7 @@ PyErr_SetFromErrnoWithFilenameObject(PyObject *exc, PyObject *filenameObject) PyErr_SetObject(exc, v); Py_DECREF(v); } -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__WINE__) || defined(__MINGW32__) LocalFree(s_buf); #endif return NULL; @@ -384,7 +392,7 @@ PyErr_SetFromErrno(PyObject *exc) return PyErr_SetFromErrnoWithFilenameObject(exc, NULL); } -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__WINE__) || defined(__MINGW32__) /* Windows specific error code handling */ PyObject *PyErr_SetExcFromWindowsErrWithFilenameObject( PyObject *exc, diff --git a/Python/getargs.c b/Python/getargs.c index 544948b..8d9abae 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -5,6 +5,14 @@ #include +#ifdef __WINE__ +/* wine's #define of INT_MIN slightly faulty... + */ +#undef INT_MIN +#define INT_MIN (-INT_MAX - 1) +#endif + + #ifdef __cplusplus extern "C" { diff --git a/Python/getopt.c b/Python/getopt.c index 247600b..4e171b0 100644 --- a/Python/getopt.c +++ b/Python/getopt.c @@ -48,7 +48,7 @@ int _PyOS_GetOpt(int argc, char **argv, char *optstring) if (_PyOS_optind >= argc) return -1; -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__MINGW32__) else if (strcmp(argv[_PyOS_optind], "/?") == 0) { ++_PyOS_optind; return 'h'; diff --git a/configure b/configure index 1e14401..4c76c13 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 68299 . +# From configure.in Revision. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.7. # @@ -654,7 +654,36 @@ build_alias host_alias target_alias VERSION +BYEBYEDOTVERSION SOVERSION +PYTHONEXTRA_OBJS +INSTALLDESTSUFFIX +PYSPECFLAGS +PYTHONDLLMSVRES +PYTHONEXEMSVRES +PGENEXEMSVRES +MSRTVER +PYTHONWINE_OBJS +GETPATH_OBJS +MODULEEXTRA_OBJS +win32build +BUILDIN_BZ2_MODULE +WINEINCLUDES +LIBWINE +THREADOBJ +INITSYS +BUILDIN_WIN32_MODULE +USE_PWD_MODULE +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +CPP +GREP +EGREP CONFIG_ARGS UNIVERSALSDK ARCH_RUN_32BIT @@ -674,21 +703,13 @@ EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET EXPORT_MACOSX_DEPLOYMENT_TARGET -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT CXX MAINCC -CPP -GREP -EGREP BUILDEXEEXT LIBRARY LDLIBRARY +LDLIBRARYIMPLIB +LDLIBRARYIMPLIBDLLNAME DLLLIBRARY BLDLIBRARY LDLIBRARYDIR @@ -718,7 +739,6 @@ USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST -THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS @@ -1315,6 +1335,12 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-msvcr9build disable/enable building with msvcr90 on win32 + platform + --enable-msvcr8build disable/enable building with msvcr80 on win32 + platform + --enable-win32build disable/enable building on win32 platform + --enable-wine disable/enable building with Wine --enable-universalsdk[=SDKDIR] Build against Mac OS X 10.4u SDK (ppc/i386) --enable-framework[=INSTALLDIR] @@ -1816,11 +1842,2229 @@ rm confdefs.h mv confdefs.h.new confdefs.h + VERSION=2.7 SOVERSION=1.0 + +PYTHONEXTRA_OBJS="Python/frozenmain.o" + +# Build Destinations vary depending on MinGW32 or "standard" unix build + +INSTALLDESTSUFFIX=/python$VERSION + +# windres-generated .RES files containing the xml-based manifests +# indicating msvcr80 or above dependence + + + + + +PYTHONDLLMSVRES= +PYTHONEXEMSVRES= +PGENEXEMSVRES= +MSRTVER= +PYSPECFLAGS="-specs=msvcr71" # default for python2.5 + +# Defined if compiling with Wine + + +PYTHONWINE_OBJS="" + +GETPATH_OBJS="Modules/getpath.o" + +MODULEEXTRA_OBJS="Modules/config.o" + + + +{ echo "$as_me:$LINENO: checking for --enable-msvcr9build" >&5 +echo $ECHO_N "checking for --enable-msvcr9build... $ECHO_C" >&6; } +# Check whether --enable-msvcr9build was given. +if test "${enable_msvcr9build+set}" = set; then + enableval=$enable_msvcr9build; case $enableval in + yes) + PYTHONDLLMSVRES="python$VERSION.dll.res" + PYTHONEXEMSVRES="python$VERSION.exe.res" + PGENEXEMSVRES="pgen.exe.res" + MSRTVER="9.0" + PYSPECFLAGS="-specs=msvcr90" + msvcr9build=yes + ;; + *) + msvcr9build=no + ;; + esac + +fi + +{ echo "$as_me:$LINENO: result: $msvcr9build" >&5 +echo "${ECHO_T}$msvcr9build" >&6; } + +{ echo "$as_me:$LINENO: checking for --enable-msvcr8build" >&5 +echo $ECHO_N "checking for --enable-msvcr8build... $ECHO_C" >&6; } +# Check whether --enable-msvcr8build was given. +if test "${enable_msvcr8build+set}" = set; then + enableval=$enable_msvcr8build; case $enableval in + yes) + PYTHONDLLMSVRES="python$VERSION.dll.res" + PYTHONEXEMSVRES="python$VERSION.exe.res" + PGENEXEMSVRES="pgen.exe.res" + MSRTVER="8.0" + PYSPECFLAGS="-specs=msvcr80" + msvcr8build=yes + ;; + *) + msvcr8build=no + ;; + esac + +fi + +{ echo "$as_me:$LINENO: result: $msvcr8build" >&5 +echo "${ECHO_T}$msvcr8build" >&6; } + + +BUILDIN_BZ2_MODULE='#' + +{ echo "$as_me:$LINENO: checking for --enable-win32build" >&5 +echo $ECHO_N "checking for --enable-win32build... $ECHO_C" >&6; } +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# Check whether --enable-win32build was given. +if test "${enable_win32build+set}" = set; then + enableval=$enable_win32build; case $enableval in + yes) + +cat >>confdefs.h <<\_ACEOF +#define MS_WINDOWS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define MS_WIN32 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FCNTL_H 1 +_ACEOF + + + + + + INITSYS='nt' + + BUILDIN_WIN32_MODULE='' + + USE_PWD_MODULE='#' + INSTALLDESTSUFFIX="" + if test "x${prefix}" = "xNONE"; then + prefix=c:/python$VERSION + fi + BASECFLAGS="$BASECFLAGS" + LDFLAGS="$LDFLAGS" + + # enable threading + THREADOBJ="Python/thread.o" + BASECFLAGS="-mthreads $BASECFLAGS" + LDFLAGS="-mthreads $LDFLAGS" + + # adding bz2 built-in - if detected - due to mingw crashes + # if bz2 is done as a module. duh. + if test "${ac_cv_header_bzlib_h+set}" = set; then + { echo "$as_me:$LINENO: checking for bzlib.h" >&5 +echo $ECHO_N "checking for bzlib.h... $ECHO_C" >&6; } +if test "${ac_cv_header_bzlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_bzlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_bzlib_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking bzlib.h usability" >&5 +echo $ECHO_N "checking bzlib.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking bzlib.h presence" >&5 +echo $ECHO_N "checking bzlib.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: bzlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: bzlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: bzlib.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: bzlib.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: bzlib.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: bzlib.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: bzlib.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: bzlib.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: bzlib.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: bzlib.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: bzlib.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: bzlib.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: bzlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: bzlib.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: bzlib.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: bzlib.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------------------------ ## +## Report this to http://www.python.org/python-bugs ## +## ------------------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for bzlib.h" >&5 +echo $ECHO_N "checking for bzlib.h... $ECHO_C" >&6; } +if test "${ac_cv_header_bzlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_bzlib_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_bzlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_bzlib_h" >&6; } + +fi +if test $ac_cv_header_bzlib_h = yes; then + + LIBS="-lbz2 $LIBS" + BUILDIN_BZ2_MODULE='' + +fi + + + + # make mingw a 32-bit compiler (this is win32 after all...) + BASECFLAGS="-m32 $BASECFLAGS" + # nt objects including pretty much every module under the sun + # (just like in the msvc build) + PYTHONWINE_OBJS="PC/dl_nt.o PC/import_nt.o" + PYTHONEXTRA_OBJS="" + GETPATH_OBJS="PC/getpathp.o" + WINEINCLUDES="-I\$(srcdir)/PC " + CFLAGS="$CFLAGS" + win32build=yes + ;; + *) + win32build=no + +for ac_header in fcntl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------------------------ ## +## Report this to http://www.python.org/python-bugs ## +## ------------------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + ;; + esac + +fi + +{ echo "$as_me:$LINENO: result: $win32build" >&5 +echo "${ECHO_T}$win32build" >&6; } + + +{ echo "$as_me:$LINENO: checking for --enable-wine" >&5 +echo $ECHO_N "checking for --enable-wine... $ECHO_C" >&6; } +# Check whether --enable-wine was given. +if test "${enable_wine+set}" = set; then + enableval=$enable_wine; case "$enableval" in + yes) + +cat >>confdefs.h <<\_ACEOF +#define __WINE__ 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define MS_WINDOWS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define MS_WIN32 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FCNTL_H 1 +_ACEOF + + + + PYTHONWINE_OBJS="PC/dl_nt.o PC/import_nt.o" + GETPATH_OBJS="PC/getpathp.o PC/config.o \ + PC/msvcrtmodule.o \ + PC/_subprocess.o \ + Modules/_bisectmodule.o Modules/_csv.o Modules/_functoolsmodule.o \ + Modules/_heapqmodule.o Modules/_hotshot.o \ + Modules/_localemodule.o Modules/_lsprof.o \ + Modules/_randommodule.o Modules/_struct.o \ + Modules/_weakref.o PC/_winreg.o \ + Modules/stropmodule.o \ + Modules/_sre.o \ + Modules/cjkcodecs/multibytecodec.o \ + Modules/cjkcodecs/_codecs_cn.o \ + Modules/cjkcodecs/_codecs_hk.o \ + Modules/cjkcodecs/_codecs_iso2022.o \ + Modules/cjkcodecs/_codecs_jp.o \ + Modules/cjkcodecs/_codecs_kr.o \ + Modules/cjkcodecs/_codecs_tw.o \ + Modules/arraymodule.o Modules/audioop.o \ + Modules/binascii.o Modules/cPickle.o \ + Modules/cStringIO.o Modules/cmathmodule.o \ + Modules/collectionsmodule.o Modules/datetimemodule.o \ + Modules/mmapmodule.o Modules/operator.o \ + Modules/imageop.o \ + Modules/rotatingtree.o \ + Modules/itertoolsmodule.o Modules/mathmodule.o \ + Modules/md5.o Modules/md5module.o \ + Modules/parsermodule.o Modules/rgbimgmodule.o \ + Modules/sha256module.o Modules/sha512module.o \ + Modules/shamodule.o Modules/timemodule.o \ + Modules/zlib/adler32.c Modules/zlib/compress.c \ + Modules/zlib/crc32.c Modules/zlib/deflate.c\ + Modules/zlib/gzio.c Modules/zlib/infback.c\ + Modules/zlib/inffast.c Modules/zlib/inflate.c\ + Modules/zlib/inftrees.c Modules/zlib/minigzip.c\ + Modules/zlib/trees.c Modules/zlib/uncompr.c\ + Modules/zlib/zutil.c\ + Modules/zlibmodule.o Modules/_codecsmodule.o" + WINEINCLUDES="-I\$(srcdir)/PC -I/usr/include/wine/msvcrt -I/usr/include/wine/windows " + CFLAGS="$CFLAGS" + LIBWINE="-lwine -lz -lmsvcrt -lmsvcr71 -lshell32 -L/usr/lib/wine \$(srcdir)/Wine/pythonlib.spec" + wine=yes + win32build=yes + ;; + *) + wine=no + ;; + esac + +fi + +{ echo "$as_me:$LINENO: result: $wine" >&5 +echo "${ECHO_T}$wine" >&6; } + +if test "$win32build" = "no" +then + +for ac_header in fcntl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------------------------ ## +## Report this to http://www.python.org/python-bugs ## +## ------------------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +fi + # The later defininition of _XOPEN_SOURCE disables certain features # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). @@ -2204,6 +4448,22 @@ fi { echo "$as_me:$LINENO: result: $MACHDEP" >&5 echo "${ECHO_T}$MACHDEP" >&6; } +if test "$win32build" = "no" +then +{ echo "$as_me:$LINENO: checking for init system calls" >&5 +echo $ECHO_N "checking for init system calls... $ECHO_C" >&6; } + +case $host in + # FIXME: May configure lack detection for os2 host system ? + #?#*-*-os2*) INITSYS=os2;; + *-*-mingw*) INITSYS=nt;; + *) INITSYS=posix;; +esac +{ echo "$as_me:$LINENO: result: $INITSYS" >&5 +echo "${ECHO_T}$INITSYS" >&6; } + +fi + # And add extra plat-mac for darwin @@ -2657,249 +4917,6 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { (ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi - -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } -if test -z "$ac_file"; then - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then @@ -3421,400 +5438,6 @@ fi # checks for UNIX variants that set C preprocessor variables -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_GREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_GREP=$GREP -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_EGREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_EGREP=$EGREP -fi - - - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - - { echo "$as_me:$LINENO: checking for AIX" >&5 echo $ECHO_N "checking for AIX... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF @@ -3922,7 +5545,12 @@ esac echo $ECHO_N "checking LIBRARY... $ECHO_C" >&6; } if test -z "$LIBRARY" then - LIBRARY='libpython$(VERSION).a' + if test "$win32build" = "no" + then + LIBRARY='libpython$(VERSION).a' + else + LIBRARY='' + fi fi { echo "$as_me:$LINENO: result: $LIBRARY" >&5 echo "${ECHO_T}$LIBRARY" >&6; } @@ -3946,6 +5574,8 @@ echo "${ECHO_T}$LIBRARY" >&6; } + + LDLIBRARY="$LIBRARY" BLDLIBRARY='$(LDLIBRARY)' INSTSONAME='$(LDLIBRARY)' @@ -3995,7 +5625,7 @@ fi if test -z "$enable_shared" then case $ac_sys_system in - CYGWIN* | atheos*) + CYGWIN*|MINGW32_NT* | atheos*) enable_shared="yes";; *) enable_shared="no";; @@ -4100,6 +5730,14 @@ _ACEOF LDLIBRARY='libpython$(VERSION).dll.a' DLLLIBRARY='libpython$(VERSION).dll' ;; + MINGW32_NT*) + BYEBYEDOTVERSION=`echo $VERSION|sed -e "s/\.//"` + LDLIBRARYIMPLIB='python$(BYEBYEDOTVERSION).lib' + LDLIBRARYIMPLIBDLLNAME='libpython$(VERSION).dll.a' + BLDLIBRARY='python$(BYEBYEDOTVERSION).lib' + DLLLIBRARY='python$(BYEBYEDOTVERSION).dll' + ;; + SunOS*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)' @@ -4148,7 +5786,7 @@ _ACEOF esac else # shared is disabled case $ac_sys_system in - CYGWIN*) + CYGWIN*|MINGW32_NT*) BLDLIBRARY='$(LIBRARY)' LDLIBRARY='libpython$(VERSION).dll.a' ;; @@ -4470,7 +6108,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test -z "$LN" ; then case $ac_sys_system in BeOS*) LN="ln -s";; - CYGWIN*) LN="ln -s";; + CYGWIN*|MINGW32_NT*) LN="ln -s";; atheos*) LN="ln -s";; *) LN=ln;; esac @@ -4930,6 +6568,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$save_CFLAGS fi +if test "$win32build" = "no" +then # On some compilers, pthreads are available without further options # (e.g. MacOS X). On some of these systems, the compiler will not # complain if unaccepted options are passed (e.g. gcc on Mac OS X). @@ -5457,75 +7097,6 @@ _ACEOF fi -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - @@ -12972,6 +14543,8 @@ echo "${ECHO_T}no" >&6; } ;; esac +fi # win32build=no! + # Set info about shared libraries. @@ -12984,16 +14557,26 @@ esac echo $ECHO_N "checking SO... $ECHO_C" >&6; } if test -z "$SO" then - case $ac_sys_system in - hp*|HP*) - case `uname -m` in - ia64) SO=.so;; - *) SO=.sl;; - esac - ;; - CYGWIN*) SO=.dll;; - *) SO=.so;; - esac + case $ac_sys_system in + hp*|HP*) + case `uname -m` in + ia64) SO=.so;; + *) SO=.sl;; + esac + ;; + CYGWIN*) SO=.dll;; + MINGW32_NT*) + #NOTE: see _PyImport_DynLoadFiletab in dynload_win.c + if test "x$Py_DEBUG" = xtrue; then + SO=_d.pyd + else + SO=.pyd + fi + ;; + *) + SO=.so + ;; + esac else # this might also be a termcap variable, see #610332 echo @@ -13120,7 +14703,7 @@ then fi;; SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';; Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";; - CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";; + CYGWIN*|MINGW32_NT*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";; atheos*) LDSHARED="gcc -shared";; *) LDSHARED="ld";; esac @@ -13212,7 +14795,7 @@ then LINKFORSHARED="-Xlinker --export-dynamic" fi;; esac;; - CYGWIN*) + CYGWIN*|MINGW32_NT*) if test $enable_shared = "no" then LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)' @@ -13236,7 +14819,7 @@ echo $ECHO_N "checking CFLAGSFORSHARED... $ECHO_C" >&6; } if test ! "$LIBRARY" = "$LDLIBRARY" then case $ac_sys_system in - CYGWIN*) + CYGWIN*|MINGW32_NT*) # Cygwin needs CCSHARED when building extension DLLs # but not when building the interpreter DLL. CFLAGSFORSHARED='';; @@ -13266,6 +14849,9 @@ esac echo "${ECHO_T}$SHLIBS" >&6; } +if test "$win32build" = "no" +then + # checks for libraries { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 @@ -13859,6 +15445,8 @@ fi { echo "$as_me:$LINENO: result: $with_system_ffi" >&5 echo "${ECHO_T}$with_system_ffi" >&6; } +fi # win31build=no + # Determine if signalmodule should be used. @@ -13889,6 +15477,8 @@ fi USE_THREAD_MODULE="" +if test "$win32build" = "no" +then { echo "$as_me:$LINENO: checking for --with-dec-threads" >&5 echo $ECHO_N "checking for --with-dec-threads... $ECHO_C" >&6; } @@ -15450,7 +17040,7 @@ if test `eval echo '${'$as_ac_var'}'` = yes; then #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF case $ac_sys_system in - CYGWIN*) + CYGWIN*|MINGW32_NT*) cat >>confdefs.h <<\_ACEOF #define HAVE_BROKEN_PTHREAD_SIGMASK 1 @@ -15464,6 +17054,19 @@ done fi +BUILDIN_WIN32_MODULE='#' + +USE_PWD_MODULE= +case $host in + *-*-mingw*) + # On win32 host(mingw build MSYS environment) site.py fail to load + # if _functools is not build-in by reason of dependency: + # setup->site->locale->functools&operator + BUILDIN_WIN32_MODULE= + USE_PWD_MODULE='#' + ;; +esac + # Check for enable-ipv6 @@ -15944,10 +17547,14 @@ echo "${ECHO_T}no" >&6; } fi +fi # win32build=no! + # -I${DLINCLDIR} is added to the compile rule for importdl.o DLINCLDIR=. +if test "$win32build" = "no" +then # the dlopen() function means we might want to use dynload_shlib.o. some # platforms, such as AIX, have dlopen(), but don't want to use it. @@ -16044,6 +17651,7 @@ _ACEOF fi done +fi # win32build=no! # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic # loading of modules. @@ -16052,27 +17660,34 @@ done echo $ECHO_N "checking DYNLOADFILE... $ECHO_C" >&6; } if test -z "$DYNLOADFILE" then - case $ac_sys_system/$ac_sys_release in - AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c - if test "$ac_cv_func_dlopen" = yes - then DYNLOADFILE="dynload_shlib.o" - else DYNLOADFILE="dynload_aix.o" - fi - ;; - BeOS*) DYNLOADFILE="dynload_beos.o";; - hp*|HP*) DYNLOADFILE="dynload_hpux.o";; - # Use dynload_next.c only on 10.2 and below, which don't have native dlopen() - Darwin/[0156]\..*) DYNLOADFILE="dynload_next.o";; - atheos*) DYNLOADFILE="dynload_atheos.o";; - *) - # use dynload_shlib.c and dlopen() if we have it; otherwise stub - # out any dynamic loading - if test "$ac_cv_func_dlopen" = yes - then DYNLOADFILE="dynload_shlib.o" - else DYNLOADFILE="dynload_stub.o" - fi - ;; - esac + case $win32build in + yes*) + DYNLOADFILE="dynload_win.o" + ;; + no*) + case $ac_sys_system/$ac_sys_release in + AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c + if test "$ac_cv_func_dlopen" = yes + then DYNLOADFILE="dynload_shlib.o" + else DYNLOADFILE="dynload_aix.o" + fi + ;; + BeOS*) DYNLOADFILE="dynload_beos.o";; + hp*|HP*) DYNLOADFILE="dynload_hpux.o";; + # Use dynload_next.c only on 10.2 and below, which don't have native dlopen() + Darwin/[0156]\..*) DYNLOADFILE="dynload_next.o";; + atheos*) DYNLOADFILE="dynload_atheos.o";; + *) + # use dynload_shlib.c and dlopen() if we have it; otherwise stub + # out any dynamic loading + if test "$ac_cv_func_dlopen" = yes + then DYNLOADFILE="dynload_shlib.o" + else DYNLOADFILE="dynload_stub.o" + fi + ;; + esac + ;; + esac fi { echo "$as_me:$LINENO: result: $DYNLOADFILE" >&5 echo "${ECHO_T}$DYNLOADFILE" >&6; } @@ -16099,6 +17714,8 @@ fi { echo "$as_me:$LINENO: result: MACHDEP_OBJS" >&5 echo "${ECHO_T}MACHDEP_OBJS" >&6; } +if test "$win32build" = "no" +then # checks for library functions @@ -22721,6 +24338,8 @@ _ACEOF ;; esac +fi # win32build=no! + @@ -22773,6 +24392,9 @@ _ACEOF echo "${ECHO_T}$PY_UNICODE_TYPE" >&6; } fi +if test "$win32build" = "no" +then + # check for endianness { echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } @@ -24774,6 +26396,8 @@ _ACEOF fi +fi # end win32build=no! + for h in `(cd $srcdir;echo Python/thread_*.h)` @@ -24782,7 +26406,7 @@ do done -SRCDIRS="Parser Grammar Objects Python Modules Mac" +SRCDIRS="Parser Grammar Objects Python Modules Mac PC Modules/zlib Modules/cjkcodecs" { echo "$as_me:$LINENO: checking for build directories" >&5 echo $ECHO_N "checking for build directories... $ECHO_C" >&6; } for dir in $SRCDIRS; do @@ -25456,7 +27080,36 @@ build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim VERSION!$VERSION$ac_delim +BYEBYEDOTVERSION!$BYEBYEDOTVERSION$ac_delim SOVERSION!$SOVERSION$ac_delim +PYTHONEXTRA_OBJS!$PYTHONEXTRA_OBJS$ac_delim +INSTALLDESTSUFFIX!$INSTALLDESTSUFFIX$ac_delim +PYSPECFLAGS!$PYSPECFLAGS$ac_delim +PYTHONDLLMSVRES!$PYTHONDLLMSVRES$ac_delim +PYTHONEXEMSVRES!$PYTHONEXEMSVRES$ac_delim +PGENEXEMSVRES!$PGENEXEMSVRES$ac_delim +MSRTVER!$MSRTVER$ac_delim +PYTHONWINE_OBJS!$PYTHONWINE_OBJS$ac_delim +GETPATH_OBJS!$GETPATH_OBJS$ac_delim +MODULEEXTRA_OBJS!$MODULEEXTRA_OBJS$ac_delim +win32build!$win32build$ac_delim +BUILDIN_BZ2_MODULE!$BUILDIN_BZ2_MODULE$ac_delim +WINEINCLUDES!$WINEINCLUDES$ac_delim +LIBWINE!$LIBWINE$ac_delim +THREADOBJ!$THREADOBJ$ac_delim +INITSYS!$INITSYS$ac_delim +BUILDIN_WIN32_MODULE!$BUILDIN_WIN32_MODULE$ac_delim +USE_PWD_MODULE!$USE_PWD_MODULE$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim CONFIG_ARGS!$CONFIG_ARGS$ac_delim UNIVERSALSDK!$UNIVERSALSDK$ac_delim ARCH_RUN_32BIT!$ARCH_RUN_32BIT$ac_delim @@ -25476,45 +27129,16 @@ EXTRAPLATDIR!$EXTRAPLATDIR$ac_delim EXTRAMACHDEPPATH!$EXTRAMACHDEPPATH$ac_delim CONFIGURE_MACOSX_DEPLOYMENT_TARGET!$CONFIGURE_MACOSX_DEPLOYMENT_TARGET$ac_delim EXPORT_MACOSX_DEPLOYMENT_TARGET!$EXPORT_MACOSX_DEPLOYMENT_TARGET$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim CXX!$CXX$ac_delim MAINCC!$MAINCC$ac_delim -CPP!$CPP$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim BUILDEXEEXT!$BUILDEXEEXT$ac_delim LIBRARY!$LIBRARY$ac_delim LDLIBRARY!$LDLIBRARY$ac_delim +LDLIBRARYIMPLIB!$LDLIBRARYIMPLIB$ac_delim +LDLIBRARYIMPLIBDLLNAME!$LDLIBRARYIMPLIBDLLNAME$ac_delim DLLLIBRARY!$DLLLIBRARY$ac_delim BLDLIBRARY!$BLDLIBRARY$ac_delim LDLIBRARYDIR!$LDLIBRARYDIR$ac_delim -INSTSONAME!$INSTSONAME$ac_delim -RUNSHARED!$RUNSHARED$ac_delim -LINKCC!$LINKCC$ac_delim -RANLIB!$RANLIB$ac_delim -AR!$AR$ac_delim -SVNVERSION!$SVNVERSION$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -LN!$LN$ac_delim -OPT!$OPT$ac_delim -BASECFLAGS!$BASECFLAGS$ac_delim -UNIVERSAL_ARCH_FLAGS!$UNIVERSAL_ARCH_FLAGS$ac_delim -OTHER_LIBTOOL_OPT!$OTHER_LIBTOOL_OPT$ac_delim -LIBTOOL_CRUFT!$LIBTOOL_CRUFT$ac_delim -SO!$SO$ac_delim -LDSHARED!$LDSHARED$ac_delim -BLDSHARED!$BLDSHARED$ac_delim -CCSHARED!$CCSHARED$ac_delim -LINKFORSHARED!$LINKFORSHARED$ac_delim -CFLAGSFORSHARED!$CFLAGSFORSHARED$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -25556,12 +27180,32 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +INSTSONAME!$INSTSONAME$ac_delim +RUNSHARED!$RUNSHARED$ac_delim +LINKCC!$LINKCC$ac_delim +RANLIB!$RANLIB$ac_delim +AR!$AR$ac_delim +SVNVERSION!$SVNVERSION$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +LN!$LN$ac_delim +OPT!$OPT$ac_delim +BASECFLAGS!$BASECFLAGS$ac_delim +UNIVERSAL_ARCH_FLAGS!$UNIVERSAL_ARCH_FLAGS$ac_delim +OTHER_LIBTOOL_OPT!$OTHER_LIBTOOL_OPT$ac_delim +LIBTOOL_CRUFT!$LIBTOOL_CRUFT$ac_delim +SO!$SO$ac_delim +LDSHARED!$LDSHARED$ac_delim +BLDSHARED!$BLDSHARED$ac_delim +CCSHARED!$CCSHARED$ac_delim +LINKFORSHARED!$LINKFORSHARED$ac_delim +CFLAGSFORSHARED!$CFLAGSFORSHARED$ac_delim SHLIBS!$SHLIBS$ac_delim USE_SIGNAL_MODULE!$USE_SIGNAL_MODULE$ac_delim SIGNAL_OBJS!$SIGNAL_OBJS$ac_delim USE_THREAD_MODULE!$USE_THREAD_MODULE$ac_delim LDLAST!$LDLAST$ac_delim -THREADOBJ!$THREADOBJ$ac_delim DLINCLDIR!$DLINCLDIR$ac_delim DYNLOADFILE!$DYNLOADFILE$ac_delim MACHDEP_OBJS!$MACHDEP_OBJS$ac_delim @@ -25580,7 +27224,7 @@ SRCDIRS!$SRCDIRS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 22; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 42; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.in b/configure.in index 2390633..e8f8ea7 100644 --- a/configure.in +++ b/configure.in @@ -34,11 +34,208 @@ rm confdefs.h mv confdefs.h.new confdefs.h AC_SUBST(VERSION) +AC_SUBST(BYEBYEDOTVERSION) VERSION=PYTHON_VERSION AC_SUBST(SOVERSION) SOVERSION=1.0 +AC_SUBST(PYTHONEXTRA_OBJS) +PYTHONEXTRA_OBJS="Python/frozenmain.o" + +# Build Destinations vary depending on MinGW32 or "standard" unix build +AC_SUBST(INSTALLDESTSUFFIX) +INSTALLDESTSUFFIX=/python$VERSION + +# windres-generated .RES files containing the xml-based manifests +# indicating msvcr80 or above dependence +AC_SUBST(PYSPECFLAGS) +AC_SUBST(PYTHONDLLMSVRES) +AC_SUBST(PYTHONEXEMSVRES) +AC_SUBST(PGENEXEMSVRES) +AC_SUBST(MSRTVER) +PYTHONDLLMSVRES= +PYTHONEXEMSVRES= +PGENEXEMSVRES= +MSRTVER= +PYSPECFLAGS="-specs=msvcr71" # default for python2.5 + +# Defined if compiling with Wine + +AC_SUBST(PYTHONWINE_OBJS) +PYTHONWINE_OBJS="" +AC_SUBST(GETPATH_OBJS) +GETPATH_OBJS="Modules/getpath.o" +AC_SUBST(MODULEEXTRA_OBJS) +MODULEEXTRA_OBJS="Modules/config.o" + +AC_SUBST(win32build) + +AC_MSG_CHECKING(for --enable-msvcr9build) +AC_ARG_ENABLE(msvcr9build, + AC_HELP_STRING(--enable-msvcr9build, disable/enable building with msvcr90 on win32 platform), +[ case $enableval in + yes) + PYTHONDLLMSVRES="python$VERSION.dll.res" + PYTHONEXEMSVRES="python$VERSION.exe.res" + PGENEXEMSVRES="pgen.exe.res" + MSRTVER="9.0" + PYSPECFLAGS="-specs=msvcr90" + msvcr9build=yes + ;; + *) + msvcr9build=no + ;; + esac ] +) +AC_MSG_RESULT($msvcr9build) + +AC_MSG_CHECKING(for --enable-msvcr8build) +AC_ARG_ENABLE(msvcr8build, + AC_HELP_STRING(--enable-msvcr8build, disable/enable building with msvcr80 on win32 platform), +[ case $enableval in + yes) + PYTHONDLLMSVRES="python$VERSION.dll.res" + PYTHONEXEMSVRES="python$VERSION.exe.res" + PGENEXEMSVRES="pgen.exe.res" + MSRTVER="8.0" + PYSPECFLAGS="-specs=msvcr80" + msvcr8build=yes + ;; + *) + msvcr8build=no + ;; + esac ] +) +AC_MSG_RESULT($msvcr8build) + +AC_SUBST(BUILDIN_BZ2_MODULE) +BUILDIN_BZ2_MODULE='#' + +AC_MSG_CHECKING(for --enable-win32build) +AC_ARG_ENABLE(win32build, + AC_HELP_STRING(--enable-win32build, disable/enable building on win32 platform), +[ case $enableval in + yes) + AC_DEFINE(MS_WINDOWS, 1, [Define Win32 Build compiling]) + AC_DEFINE(MS_WIN32, 1, [Define Win32 Build compiling]) + AC_DEFINE(HAVE_FCNTL_H, 1, [Define fcntl.h]) + AC_SUBST(WINEINCLUDES) + AC_SUBST(LIBWINE) + AC_SUBST(THREADOBJ) + AC_SUBST(INITSYS) + INITSYS='nt' + AC_SUBST(BUILDIN_WIN32_MODULE) + BUILDIN_WIN32_MODULE='' + AC_SUBST(USE_PWD_MODULE) + USE_PWD_MODULE='#' + INSTALLDESTSUFFIX="" + if test "x${prefix}" = "xNONE"; then + prefix=c:/python$VERSION + fi + BASECFLAGS="$BASECFLAGS" + LDFLAGS="$LDFLAGS" + + # enable threading + THREADOBJ="Python/thread.o" + BASECFLAGS="-mthreads $BASECFLAGS" + LDFLAGS="-mthreads $LDFLAGS" + + # adding bz2 built-in - if detected - due to mingw crashes + # if bz2 is done as a module. duh. + AC_CHECK_HEADER(bzlib.h, + [ + LIBS="-lbz2 $LIBS" + BUILDIN_BZ2_MODULE='' + ],) + + # make mingw a 32-bit compiler (this is win32 after all...) + BASECFLAGS="-m32 $BASECFLAGS" + # nt objects including pretty much every module under the sun + # (just like in the msvc build) + PYTHONWINE_OBJS="PC/dl_nt.o PC/import_nt.o" + PYTHONEXTRA_OBJS="" + GETPATH_OBJS="PC/getpathp.o" + WINEINCLUDES="-I\$(srcdir)/PC " + CFLAGS="$CFLAGS" + win32build=yes + ;; + *) + win32build=no + AC_CHECK_HEADERS(fcntl.h) + ;; + esac ] +) +AC_MSG_RESULT($win32build) + + +AC_MSG_CHECKING(for --enable-wine) +AC_ARG_ENABLE(wine, + AC_HELP_STRING(--enable-wine, disable/enable building with Wine), +[ case "$enableval" in + yes) + AC_DEFINE(__WINE__, 1, [Define on Linux to compile with Wine]) + AC_DEFINE(MS_WINDOWS, 1, [Define with Wine compiling]) + AC_DEFINE(MS_WIN32, 1, [Define with Wine compiling]) + AC_DEFINE(HAVE_FCNTL_H, 1, [Define fcntl.h]) + AC_SUBST(WINEINCLUDES) + AC_SUBST(LIBWINE) + PYTHONWINE_OBJS="PC/dl_nt.o PC/import_nt.o" + GETPATH_OBJS="PC/getpathp.o PC/config.o \ + PC/msvcrtmodule.o \ + PC/_subprocess.o \ + Modules/_bisectmodule.o Modules/_csv.o Modules/_functoolsmodule.o \ + Modules/_heapqmodule.o Modules/_hotshot.o \ + Modules/_localemodule.o Modules/_lsprof.o \ + Modules/_randommodule.o Modules/_struct.o \ + Modules/_weakref.o PC/_winreg.o \ + Modules/stropmodule.o \ + Modules/_sre.o \ + Modules/cjkcodecs/multibytecodec.o \ + Modules/cjkcodecs/_codecs_cn.o \ + Modules/cjkcodecs/_codecs_hk.o \ + Modules/cjkcodecs/_codecs_iso2022.o \ + Modules/cjkcodecs/_codecs_jp.o \ + Modules/cjkcodecs/_codecs_kr.o \ + Modules/cjkcodecs/_codecs_tw.o \ + Modules/arraymodule.o Modules/audioop.o \ + Modules/binascii.o Modules/cPickle.o \ + Modules/cStringIO.o Modules/cmathmodule.o \ + Modules/collectionsmodule.o Modules/datetimemodule.o \ + Modules/mmapmodule.o Modules/operator.o \ + Modules/imageop.o \ + Modules/rotatingtree.o \ + Modules/itertoolsmodule.o Modules/mathmodule.o \ + Modules/md5.o Modules/md5module.o \ + Modules/parsermodule.o Modules/rgbimgmodule.o \ + Modules/sha256module.o Modules/sha512module.o \ + Modules/shamodule.o Modules/timemodule.o \ + Modules/zlib/adler32.c Modules/zlib/compress.c \ + Modules/zlib/crc32.c Modules/zlib/deflate.c\ + Modules/zlib/gzio.c Modules/zlib/infback.c\ + Modules/zlib/inffast.c Modules/zlib/inflate.c\ + Modules/zlib/inftrees.c Modules/zlib/minigzip.c\ + Modules/zlib/trees.c Modules/zlib/uncompr.c\ + Modules/zlib/zutil.c\ + Modules/zlibmodule.o Modules/_codecsmodule.o" + WINEINCLUDES="-I\$(srcdir)/PC -I/usr/include/wine/msvcrt -I/usr/include/wine/windows " + CFLAGS="$CFLAGS" + LIBWINE="-lwine -lz -lmsvcrt -lmsvcr71 -lshell32 -L/usr/lib/wine \$(srcdir)/Wine/pythonlib.spec" + wine=yes + win32build=yes + ;; + *) + wine=no + ;; + esac ] +) +AC_MSG_RESULT($wine) + +if test "$win32build" = "no" +then + AC_CHECK_HEADERS(fcntl.h) +fi + # The later defininition of _XOPEN_SOURCE disables certain features # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features]) @@ -361,6 +558,20 @@ then fi AC_MSG_RESULT($MACHDEP) +if test "$win32build" = "no" +then +AC_MSG_CHECKING([for init system calls]) +AC_SUBST(INITSYS) +case $host in + # FIXME: May configure lack detection for os2 host system ? + #?#*-*-os2*) INITSYS=os2;; + *-*-mingw*) INITSYS=nt;; + *) INITSYS=posix;; +esac +AC_MSG_RESULT([$INITSYS]) + +fi + # And add extra plat-mac for darwin AC_SUBST(EXTRAPLATDIR) AC_SUBST(EXTRAMACHDEPPATH) @@ -577,7 +788,12 @@ AC_SUBST(LIBRARY) AC_MSG_CHECKING(LIBRARY) if test -z "$LIBRARY" then - LIBRARY='libpython$(VERSION).a' + if test "$win32build" = "no" + then + LIBRARY='libpython$(VERSION).a' + else + LIBRARY='' + fi fi AC_MSG_RESULT($LIBRARY) @@ -595,6 +811,8 @@ AC_MSG_RESULT($LIBRARY) # INSTSONAME is the name of the shared library that will be use to install # on the system - some systems like version suffix, others don't AC_SUBST(LDLIBRARY) +AC_SUBST(LDLIBRARYIMPLIB) +AC_SUBST(LDLIBRARYIMPLIBDLLNAME) AC_SUBST(DLLLIBRARY) AC_SUBST(BLDLIBRARY) AC_SUBST(LDLIBRARYDIR) @@ -643,7 +861,7 @@ AC_ARG_ENABLE(shared, if test -z "$enable_shared" then case $ac_sys_system in - CYGWIN* | atheos*) + CYGWIN*|MINGW32_NT* | atheos*) enable_shared="yes";; *) enable_shared="no";; @@ -698,6 +916,14 @@ if test $enable_shared = "yes"; then LDLIBRARY='libpython$(VERSION).dll.a' DLLLIBRARY='libpython$(VERSION).dll' ;; + MINGW32_NT*) + BYEBYEDOTVERSION=`echo $VERSION|sed -e "s/\.//"` + LDLIBRARYIMPLIB='python$(BYEBYEDOTVERSION).lib' + LDLIBRARYIMPLIBDLLNAME='libpython$(VERSION).dll.a' + BLDLIBRARY='python$(BYEBYEDOTVERSION).lib' + DLLLIBRARY='python$(BYEBYEDOTVERSION).dll' + ;; + SunOS*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)' @@ -746,7 +972,7 @@ if test $enable_shared = "yes"; then esac else # shared is disabled case $ac_sys_system in - CYGWIN*) + CYGWIN*|MINGW32_NT*) BLDLIBRARY='$(LIBRARY)' LDLIBRARY='libpython$(VERSION).dll.a' ;; @@ -783,7 +1009,7 @@ AC_SUBST(LN) if test -z "$LN" ; then case $ac_sys_system in BeOS*) LN="ln -s";; - CYGWIN*) LN="ln -s";; + CYGWIN*|MINGW32_NT*) LN="ln -s";; atheos*) LN="ln -s";; *) LN=ln;; esac @@ -1051,6 +1277,8 @@ then CFLAGS=$save_CFLAGS fi +if test "$win32build" = "no" +then # On some compilers, pthreads are available without further options # (e.g. MacOS X). On some of these systems, the compiler will not # complain if unaccepted options are passed (e.g. gcc on Mac OS X). @@ -1569,6 +1797,8 @@ case $ac_sys_system/$ac_sys_release in ;; esac +fi # win32build=no! + # Set info about shared libraries. AC_SUBST(SO) AC_SUBST(LDSHARED) @@ -1580,16 +1810,26 @@ AC_SUBST(LINKFORSHARED) AC_MSG_CHECKING(SO) if test -z "$SO" then - case $ac_sys_system in - hp*|HP*) - case `uname -m` in - ia64) SO=.so;; - *) SO=.sl;; - esac - ;; - CYGWIN*) SO=.dll;; - *) SO=.so;; - esac + case $ac_sys_system in + hp*|HP*) + case `uname -m` in + ia64) SO=.so;; + *) SO=.sl;; + esac + ;; + CYGWIN*) SO=.dll;; + MINGW32_NT*) + #NOTE: see _PyImport_DynLoadFiletab in dynload_win.c + if test "x$Py_DEBUG" = xtrue; then + SO=_d.pyd + else + SO=.pyd + fi + ;; + *) + SO=.so + ;; + esac else # this might also be a termcap variable, see #610332 echo @@ -1710,7 +1950,7 @@ then fi;; SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';; Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";; - CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";; + CYGWIN*|MINGW32_NT*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";; atheos*) LDSHARED="gcc -shared";; *) LDSHARED="ld";; esac @@ -1798,7 +2038,7 @@ then LINKFORSHARED="-Xlinker --export-dynamic" fi;; esac;; - CYGWIN*) + CYGWIN*|MINGW32_NT*) if test $enable_shared = "no" then LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)' @@ -1820,7 +2060,7 @@ AC_MSG_CHECKING(CFLAGSFORSHARED) if test ! "$LIBRARY" = "$LDLIBRARY" then case $ac_sys_system in - CYGWIN*) + CYGWIN*|MINGW32_NT*) # Cygwin needs CCSHARED when building extension DLLs # but not when building the interpreter DLL. CFLAGSFORSHARED='';; @@ -1847,6 +2087,9 @@ esac AC_MSG_RESULT($SHLIBS) +if test "$win32build" = "no" +then + # checks for libraries AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX @@ -1903,6 +2146,8 @@ AC_ARG_WITH(system_ffi, AC_MSG_RESULT($with_system_ffi) +fi # win31build=no + # Determine if signalmodule should be used. AC_SUBST(USE_SIGNAL_MODULE) AC_SUBST(SIGNAL_OBJS) @@ -1927,6 +2172,8 @@ fi AC_SUBST(USE_THREAD_MODULE) USE_THREAD_MODULE="" +if test "$win32build" = "no" +then AC_MSG_CHECKING(for --with-dec-threads) AC_SUBST(LDLAST) AC_ARG_WITH(dec-threads, @@ -2156,13 +2403,26 @@ if test "$posix_threads" = "yes"; then fi AC_CHECK_FUNCS(pthread_sigmask, [case $ac_sys_system in - CYGWIN*) + CYGWIN*|MINGW32_NT*) AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1, [Define if pthread_sigmask() does not work on your system.]) ;; esac]) fi +AC_SUBST(BUILDIN_WIN32_MODULE) +BUILDIN_WIN32_MODULE='#' +AC_SUBST(USE_PWD_MODULE) +USE_PWD_MODULE= +case $host in + *-*-mingw*) + # On win32 host(mingw build MSYS environment) site.py fail to load + # if _functools is not build-in by reason of dependency: + # setup->site->locale->functools&operator + BUILDIN_WIN32_MODULE= + USE_PWD_MODULE='#' + ;; +esac # Check for enable-ipv6 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) @@ -2396,13 +2656,18 @@ else AC_MSG_RESULT(no) fi], [AC_MSG_RESULT(no)]) +fi # win32build=no! + # -I${DLINCLDIR} is added to the compile rule for importdl.o AC_SUBST(DLINCLDIR) DLINCLDIR=. +if test "$win32build" = "no" +then # the dlopen() function means we might want to use dynload_shlib.o. some # platforms, such as AIX, have dlopen(), but don't want to use it. AC_CHECK_FUNCS(dlopen) +fi # win32build=no! # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic # loading of modules. @@ -2410,27 +2675,34 @@ AC_SUBST(DYNLOADFILE) AC_MSG_CHECKING(DYNLOADFILE) if test -z "$DYNLOADFILE" then - case $ac_sys_system/$ac_sys_release in - AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c - if test "$ac_cv_func_dlopen" = yes - then DYNLOADFILE="dynload_shlib.o" - else DYNLOADFILE="dynload_aix.o" - fi - ;; - BeOS*) DYNLOADFILE="dynload_beos.o";; - hp*|HP*) DYNLOADFILE="dynload_hpux.o";; - # Use dynload_next.c only on 10.2 and below, which don't have native dlopen() - Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";; - atheos*) DYNLOADFILE="dynload_atheos.o";; - *) - # use dynload_shlib.c and dlopen() if we have it; otherwise stub - # out any dynamic loading - if test "$ac_cv_func_dlopen" = yes - then DYNLOADFILE="dynload_shlib.o" - else DYNLOADFILE="dynload_stub.o" - fi - ;; - esac + case $win32build in + yes*) + DYNLOADFILE="dynload_win.o" + ;; + no*) + case $ac_sys_system/$ac_sys_release in + AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c + if test "$ac_cv_func_dlopen" = yes + then DYNLOADFILE="dynload_shlib.o" + else DYNLOADFILE="dynload_aix.o" + fi + ;; + BeOS*) DYNLOADFILE="dynload_beos.o";; + hp*|HP*) DYNLOADFILE="dynload_hpux.o";; + # Use dynload_next.c only on 10.2 and below, which don't have native dlopen() + Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";; + atheos*) DYNLOADFILE="dynload_atheos.o";; + *) + # use dynload_shlib.c and dlopen() if we have it; otherwise stub + # out any dynamic loading + if test "$ac_cv_func_dlopen" = yes + then DYNLOADFILE="dynload_shlib.o" + else DYNLOADFILE="dynload_stub.o" + fi + ;; + esac + ;; + esac fi AC_MSG_RESULT($DYNLOADFILE) if test "$DYNLOADFILE" != "dynload_stub.o" @@ -2451,6 +2723,8 @@ else fi AC_MSG_RESULT(MACHDEP_OBJS) +if test "$win32build" = "no" +then # checks for library functions AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \ clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \ @@ -3288,6 +3562,8 @@ ucs4) unicode_size="4" ;; esac +fi # win32build=no! + AH_TEMPLATE(PY_UNICODE_TYPE, [Define as the integral type used for Unicode representation.]) @@ -3325,6 +3601,9 @@ else AC_MSG_RESULT($PY_UNICODE_TYPE) fi +if test "$win32build" = "no" +then + # check for endianness AC_C_BIGENDIAN @@ -3743,6 +4022,8 @@ AC_CHECK_TYPE(socklen_t,, #endif ]) +fi # end win32build=no! + AC_SUBST(THREADHEADERS) for h in `(cd $srcdir;echo Python/thread_*.h)` @@ -3751,7 +4032,7 @@ do done AC_SUBST(SRCDIRS) -SRCDIRS="Parser Grammar Objects Python Modules Mac" +SRCDIRS="Parser Grammar Objects Python Modules Mac PC Modules/zlib Modules/cjkcodecs" AC_MSG_CHECKING(for build directories) for dir in $SRCDIRS; do if test ! -d $dir; then diff --git a/pyconfig.h.in b/pyconfig.h.in index 82285bd..06b8279 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -827,6 +827,12 @@ . */ #undef MAJOR_IN_SYSMACROS +/* Define with Wine compiling */ +#undef MS_WIN32 + +/* Define with Wine compiling */ +#undef MS_WINDOWS + /* Define if mvwdelch in curses.h is an expression. */ #undef MVWDELCH_IS_EXPRESSION @@ -1049,6 +1055,9 @@ /* Defined on Solaris to see additional function prototypes. */ #undef __EXTENSIONS__ +/* Define on Linux to compile with Wine */ +#undef __WINE__ + /* Define to 'long' if doesn't define. */ #undef clock_t diff --git a/setup.py b/setup.py index 1aa14d1..fcc3bf2 100644 --- a/setup.py +++ b/setup.py @@ -100,6 +100,7 @@ class PyBuildExt(build_ext): def build_extensions(self): # Detect which modules should be compiled + platform = self.get_platform() missing = self.detect_modules() # Remove modules that are present on the disabled list @@ -195,9 +196,40 @@ class PyBuildExt(build_ext): # compilers if compiler is not None: (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS') + args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags + + # FIXME: Is next correct ? + # To link modules we need LDSHARED passed to setup.py otherwise + # distutils will use linker from build system if cross-compiling. + linker_so = os.environ.get('LDSHARED') + if linker_so is not None: + args['linker_so'] = linker_so + self.compiler.set_executables(**args) + if platform in ['mingw', 'win32']: + # FIXME: best way to pass just build python library to the modules + self.compiler.library_dirs.insert(0, '.') + data = open('pyconfig.h').read() + m = re.search(r"#s*define\s+Py_DEBUG\s+1\s*", data) + if m is not None: + self.compiler.libraries.append("python" + str(sysconfig.get_config_var('VERSION')) + "_d") + else: + self.compiler.libraries.append("python" + str(sysconfig.get_config_var('VERSION'))) + + if platform in ['mingw', 'win32']: + # NOTE: See comment for SHLIBS in configure.in . + # Although it look obsolete since setup.py add module + # required libraries we will pass list too. + # As example this will allow us to propage static + # libraries like mingwex to modules. + for lib in sysconfig.get_config_var('SHLIBS').split(): + if lib.startswith('-l'): + self.compiler.libraries.append(lib[2:]) + else: + self.compiler.libraries.append(lib) + build_ext.build_extensions(self) longest = max([len(e.name) for e in self.extensions]) @@ -268,6 +300,10 @@ class PyBuildExt(build_ext): self.announce('WARNING: skipping import check for Cygwin-based "%s"' % ext.name) return + if os.environ.get('HOST_OS') is not None: + self.announce('WARNING: skipping import check for cross-compiled "%s"' + % ext.name) + return ext_filename = os.path.join( self.build_lib, self.get_ext_filename(self.get_ext_fullname(ext.name))) @@ -303,6 +339,19 @@ class PyBuildExt(build_ext): self.failed.append(ext.name) def get_platform(self): + # Get value of host platform (set only if cross-compile) + host_os=os.environ.get('HOST_OS') + if host_os is not None: + # FIXME: extend for other host platforms. + # Until isn't confirmed that we can use 'win32' in all places + # where 'mingw' is use alone this method has to return 'mingw' + # otherwise uncomment next two lines: + #if host_os.startswith('mingw'): + # return 'win32' + for platform in ['mingw', 'cygwin', 'beos', 'darwin', 'atheos', 'osf1']: + if host_os.startswith(platform): + return platform + return host_os # Get value of sys.platform for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']: if sys.platform.startswith(platform): @@ -320,6 +369,9 @@ class PyBuildExt(build_ext): # directly since an inconsistently reproducible issue comes up where # the environment variable is not set even though the value were passed # into configure and stored in the Makefile (issue found on OS X 10.3). + # In cross-compilation environment python for build system + # is linked in top build directory under name syspython to get + # above to work (distutils hack). for env_var, arg_name, dir_list in ( ('LDFLAGS', '-R', self.compiler.runtime_library_dirs), ('LDFLAGS', '-L', self.compiler.library_dirs), @@ -362,11 +414,17 @@ class PyBuildExt(build_ext): # lib_dirs and inc_dirs are used to search for files; # if a file is found in one of those directories, it can # be assumed that no additional -I,-L directives are needed. - lib_dirs = self.compiler.library_dirs + [ + lib_dirs = self.compiler.library_dirs + inc_dirs = self.compiler.include_dirs + if sys.version.find('mingw') >= 0: + inc_dirs.append('c:/mingw/include') + lib_dirs.append('c:/mingw/lib') + else: + inc_dirs.append('/usr/include') + lib_dirs += [ '/lib64', '/usr/lib64', '/lib', '/usr/lib', ] - inc_dirs = self.compiler.include_dirs + ['/usr/include'] exts = [] missing = [] @@ -394,6 +452,7 @@ class PyBuildExt(build_ext): # NOTE: using shlex.split would technically be more correct, but # also gives a bootstrap problem. Let's hope nobody uses directories # with whitespace in the name to store libraries. + # FIXME: Why LDFLAGS again ? cflags, ldflags = sysconfig.get_config_vars( 'CFLAGS', 'LDFLAGS') for item in cflags.split(): @@ -406,7 +465,7 @@ class PyBuildExt(build_ext): # Check for MacOS X, which doesn't need libm.a at all math_libs = ['m'] - if platform in ['darwin', 'beos', 'mac']: + if platform in ['darwin', 'beos', 'mac', 'mingw', 'win32']: math_libs = [] # XXX Omitted modules: gl, pure, dl, SGI-specific modules @@ -481,7 +540,10 @@ class PyBuildExt(build_ext): locale_extra_link_args = [] - exts.append( Extension('_locale', ['_localemodule.c'], + # On win32 host(mingw build in MSYS environment) show that site.py + # fail to load if some modules are not build-in: + if platform not in ['mingw', 'win32']: + exts.append( Extension('_locale', ['_localemodule.c'], libraries=locale_libs, extra_link_args=locale_extra_link_args) ) @@ -490,8 +552,11 @@ class PyBuildExt(build_ext): # supported...) # fcntl(2) and ioctl(2) - exts.append( Extension('fcntl', ['fcntlmodule.c']) ) - if platform not in ['mac']: + if platform not in ['mingw', 'win32']: + exts.append( Extension('fcntl', ['fcntlmodule.c']) ) + else: + missing.append('fcntl') + if platform not in ['mac', 'mingw', 'win32']: # pwd(3) exts.append( Extension('pwd', ['pwdmodule.c']) ) # grp(3) @@ -506,7 +571,12 @@ class PyBuildExt(build_ext): missing.extend(['pwd', 'grp', 'spwd']) # select(2); not on ancient System V - exts.append( Extension('select', ['selectmodule.c']) ) + if platform in ['mingw', 'win32']: + select_libs = ['ws2_32'] + else: + select_libs = [] + exts.append( Extension('select', ['selectmodule.c'], + libraries=select_libs) ) # Fred Drake's interface to the Python parser exts.append( Extension('parser', ['parsermodule.c']) ) @@ -522,7 +592,7 @@ class PyBuildExt(build_ext): missing.append('mmap') # Lance Ellinghaus's syslog module - if platform not in ['mac']: + if platform not in ['mac', 'mingw', 'win32']: # syslog daemon interface exts.append( Extension('syslog', ['syslogmodule.c']) ) else: @@ -565,7 +635,7 @@ class PyBuildExt(build_ext): if find_file('readline/rlconf.h', inc_dirs, []) is None: do_readline = False if do_readline: - if sys.platform == 'darwin': + if platform == 'darwin': # In every directory on the search path search for a dynamic # library and then a static library, instead of first looking # for dynamic libraries on the entiry path. @@ -595,7 +665,7 @@ class PyBuildExt(build_ext): else: missing.append('readline') - if platform not in ['mac']: + if platform not in ['mac', 'mingw', 'win32']: # crypt module. if self.compiler.find_library_file(lib_dirs, 'crypt'): @@ -610,7 +680,12 @@ class PyBuildExt(build_ext): exts.append( Extension('_csv', ['_csv.c']) ) # socket(2) + if platform in ['mingw', 'win32']: + socket_libs = ['ws2_32'] + else: + socket_libs = [] exts.append( Extension('_socket', ['socketmodule.c'], + libraries=socket_libs, depends = ['socketmodule.h']) ) # Detect SSL support for the socket module (via _ssl) search_for_ssl_incs_in = [ @@ -632,10 +707,13 @@ class PyBuildExt(build_ext): if (ssl_incs is not None and ssl_libs is not None): + ssl_libs = ['ssl', 'crypto'] + if platform in ['mingw', 'win32']: + ssl_libs.append('ws2_32') exts.append( Extension('_ssl', ['_ssl.c'], include_dirs = ssl_incs, library_dirs = ssl_libs, - libraries = ['ssl', 'crypto'], + libraries = ssl_libs, depends = ['socketmodule.h']), ) else: missing.append('_ssl') @@ -738,6 +816,32 @@ class PyBuildExt(build_ext): else: raise ValueError("unknown major BerkeleyDB version", major) + # Modules with some Windows dependencies: + if platform in ['mingw', 'win32']: + (srcdir,) = sysconfig.get_config_vars('srcdir') + pc_srcdir = os.path.abspath(os.path.join(srcdir, 'PC')) + + exts.append( Extension('msvcrt', [os.path.join(pc_srcdir, p) + for p in ['msvcrtmodule.c']]) ) + + exts.append( Extension('_msi', [os.path.join(pc_srcdir, p) + for p in ['_msi.c']], + libraries=['msi', 'cabinet', 'rpcrt4']) ) + + exts.append( Extension('_subprocess', [os.path.join(pc_srcdir, p) + for p in ['_subprocess.c']]) ) + + # On win32 host(mingw build in MSYS environment) show that site.py + # fail to load if some modules are not build-in: + #exts.append( Extension('_winreg', [os.path.join(pc_srcdir, p) + # for p in ['_winreg.c']]) ) + + exts.append( Extension('winsound', [os.path.join(pc_srcdir, p) + for p in ['winsound.c']], + libraries=['winmm']) ) + + + # construct a list of paths to look for the header file in on # top of the normal inc_dirs. db_inc_paths = [ @@ -951,13 +1055,13 @@ class PyBuildExt(build_ext): '_sqlite/util.c', ] sqlite_defines = [] - if sys.platform != "win32": + if not platform in ['mingw', 'win32']: sqlite_defines.append(('MODULE_NAME', '"sqlite3"')) else: sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"')) - if sys.platform == 'darwin': + if platform == 'darwin': # In every directory on the search path search for a dynamic # library and then a static library, instead of first looking # for dynamic libraries on the entiry path. @@ -1011,51 +1115,76 @@ class PyBuildExt(build_ext): # The standard Unix dbm module: if platform not in ['cygwin']: - if find_file("ndbm.h", inc_dirs, []) is not None: - # Some systems have -lndbm, others don't - if self.compiler.find_library_file(lib_dirs, 'ndbm'): - ndbm_libs = ['ndbm'] - else: - ndbm_libs = [] - exts.append( Extension('dbm', ['dbmmodule.c'], - define_macros=[('HAVE_NDBM_H',None)], - libraries = ndbm_libs ) ) - elif self.compiler.find_library_file(lib_dirs, 'gdbm'): - gdbm_libs = ['gdbm'] - if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'): - gdbm_libs.append('gdbm_compat') - if find_file("gdbm/ndbm.h", inc_dirs, []) is not None: - exts.append( Extension( - 'dbm', ['dbmmodule.c'], - define_macros=[('HAVE_GDBM_NDBM_H',None)], - libraries = gdbm_libs ) ) - elif find_file("gdbm-ndbm.h", inc_dirs, []) is not None: - exts.append( Extension( - 'dbm', ['dbmmodule.c'], - define_macros=[('HAVE_GDBM_DASH_NDBM_H',None)], - libraries = gdbm_libs ) ) - else: - missing.append('dbm') - elif db_incs is not None: - exts.append( Extension('dbm', ['dbmmodule.c'], - library_dirs=dblib_dir, - runtime_library_dirs=dblib_dir, - include_dirs=db_incs, - define_macros=[('HAVE_BERKDB_H',None), - ('DB_DBM_HSEARCH',None)], - libraries=dblibs)) + dbm_order = os.environ.get("PYDBMLIBORDER", + "ndbm:gdbm:bdb").split(":") + dbmext = None + for cand in dbm_order: + if cand == "ndbm": + if find_file("ndbm.h", inc_dirs, []) is not None: + # Some systems have -lndbm, others don't + if self.compiler.find_library_file(lib_dirs, 'ndbm'): + ndbm_libs = ['ndbm'] + else: + ndbm_libs = [] + print "building dbm using ndbm" + dbmext = Extension('dbm', ['dbmmodule.c'], + define_macros=[ + ('HAVE_NDBM_H',None), + ], + libraries=ndbm_libs) + break + + elif cand == "gdbm": + if self.compiler.find_library_file(lib_dirs, 'gdbm'): + gdbm_libs = ['gdbm'] + if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'): + gdbm_libs.append('gdbm_compat') + if find_file("gdbm/ndbm.h", inc_dirs, []) is not None: + print "building dbm using gdbm" + dbmext = Extension( + 'dbm', ['dbmmodule.c'], + define_macros=[ + ('HAVE_GDBM_NDBM_H', None), + ], + libraries = gdbm_libs) + break + if find_file("gdbm-ndbm.h", inc_dirs, []) is not None: + print "building dbm using gdbm" + dbmext = Extension( + 'dbm', ['dbmmodule.c'], + define_macros=[ + ('HAVE_GDBM_DASH_NDBM_H', None), + ], + libraries = gdbm_libs) + break + elif cand == "bdb": + if db_incs is not None: + print "building dbm using bdb" + dbmext = Extension('dbm', ['dbmmodule.c'], + library_dirs=dblib_dir, + runtime_library_dirs=dblib_dir, + include_dirs=db_incs, + define_macros=[ + ('HAVE_BERKDB_H', None), + ('DB_DBM_HSEARCH', None), + ], + libraries=dblibs) + break + if dbmext is not None: + exts.append(dbmext) else: missing.append('dbm') # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: - if (self.compiler.find_library_file(lib_dirs, 'gdbm')): + if (platform not in ['mingw', 'win32'] and + self.compiler.find_library_file(lib_dirs, 'gdbm')): exts.append( Extension('gdbm', ['gdbmmodule.c'], libraries = ['gdbm'] ) ) else: missing.append('gdbm') # Unix-only modules - if platform not in ['mac', 'win32']: + if platform not in ['mac', 'mingw', 'win32']: # Steen Lumholt's termios module exts.append( Extension('termios', ['termios.c']) ) # Jeremy Hylton's rlimit interface @@ -1077,10 +1206,16 @@ class PyBuildExt(build_ext): else: missing.extend(['nis', 'resource', 'termios']) + # Curses support, requiring the System V version of curses, often # provided by the ncurses library. panel_library = 'panel' - if (self.compiler.find_library_file(lib_dirs, 'ncursesw')): + if platform in ['mingw', 'win32']: + # Native build is without _curses module. + # Also in cross-compilation environment the code below + # find libraries from build system, so ignore it. + pass + elif (self.compiler.find_library_file(lib_dirs, 'ncursesw')): curses_libs = ['ncursesw'] # Bug 1464056: If _curses.so links with ncursesw, # _curses_panel.so must link with panelw. @@ -1143,7 +1278,7 @@ class PyBuildExt(build_ext): break if version >= version_req: if (self.compiler.find_library_file(lib_dirs, 'z')): - if sys.platform == "darwin": + if platform == "darwin": zlib_extra_link_args = ('-Wl,-search_paths_first',) else: zlib_extra_link_args = () @@ -1173,9 +1308,10 @@ class PyBuildExt(build_ext): libraries = libraries, extra_link_args = extra_link_args) ) + # Gustavo Niemeyer's bz2 module. if (self.compiler.find_library_file(lib_dirs, 'bz2')): - if sys.platform == "darwin": + if platform == "darwin": bz2_extra_link_args = ('-Wl,-search_paths_first',) else: bz2_extra_link_args = () @@ -1240,7 +1376,7 @@ class PyBuildExt(build_ext): if sys.maxint == 0x7fffffff: # This requires sizeof(int) == sizeof(long) == sizeof(char*) dl_inc = find_file('dlfcn.h', [], inc_dirs) - if (dl_inc is not None) and (platform not in ['atheos']): + if (dl_inc is not None) and (platform not in ['atheos', 'mingw', 'win32']): exts.append( Extension('dl', ['dlmodule.c']) ) else: missing.append('dl') @@ -1318,6 +1454,7 @@ class PyBuildExt(build_ext): if sysconfig.get_config_var('WITH_THREAD'): exts.append ( Extension('_multiprocessing', multiprocessing_srcs, define_macros=macros.items(), + libraries=libraries, include_dirs=["Modules/_multiprocessing"])) else: missing.append('_multiprocessing') @@ -1347,6 +1484,7 @@ class PyBuildExt(build_ext): if platform == 'darwin' and ("--disable-toolbox-glue" not in sysconfig.get_config_var("CONFIG_ARGS")): + #FIXME: next fail in cross-compilation environment if os.uname()[2] > '8.': # We're on Mac OS X 10.4 or later, the compiler should # support '-Wno-deprecated-declarations'. This will @@ -1549,7 +1687,7 @@ class PyBuildExt(build_ext): # Check for the include files on Debian and {Free,Open}BSD, where # they're put in /usr/include/{tcl,tk}X.Y dotversion = version - if '.' not in dotversion and "bsd" in sys.platform.lower(): + if '.' not in dotversion and "bsd" in platform.lower(): # OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a, # but the include subdirs are named like .../include/tcl8.3. dotversion = dotversion[:-1] + '.' + dotversion[-1] @@ -1578,6 +1716,9 @@ class PyBuildExt(build_ext): if platform == 'sunos5': include_dirs.append('/usr/openwin/include') added_lib_dirs.append('/usr/openwin/lib') + elif platform in ['mingw', 'win32']: + # mingw&win32 don't use X11 headers and libraries + pass elif os.path.exists('/usr/X11R6/include'): include_dirs.append('/usr/X11R6/include') added_lib_dirs.append('/usr/X11R6/lib64') @@ -1613,8 +1754,8 @@ class PyBuildExt(build_ext): if platform in ['aix3', 'aix4']: libs.append('ld') - # Finally, link with the X11 libraries (not appropriate on cygwin) - if platform != "cygwin": + # Finally, link with the X11 libraries (not appropriate on cygwin, mingw) + if not platform in ['cygwin', 'mingw', 'win32']: libs.append('X11') ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], @@ -1665,6 +1806,30 @@ class PyBuildExt(build_ext): return True def configure_ctypes(self, ext): + platform = self.get_platform() + if platform in ['mingw', 'win32']: + # win32 platform use own sources and includes + # from Modules/_ctypes/libffi_msvc/ + (srcdir,) = sysconfig.get_config_vars('srcdir') + ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules', + '_ctypes', 'libffi_msvc')) + #FIXME: _ctypes/libffi_msvc/win64.asm ? + sources = [os.path.join(ffi_srcdir, p) + for p in ['ffi.c', + 'prep_cif.c', + 'win32.S', + ]] + self.compiler.src_extensions.append('.S') + ext.include_dirs.append(ffi_srcdir) + ext.sources.extend(sources) + ext.libraries.extend(['ole32', 'oleaut32', 'uuid']) + #AdditionalOptions="/EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE" + ext.export_symbols.extend(['DllGetClassObject PRIVATE', + 'DllCanUnloadNow PRIVATE']) + ext.extra_compile_args.extend(["-DX86_WIN32"]) + + return True + if not self.use_system_libffi: if sys.platform == 'darwin': return self.configure_ctypes_darwin(ext) @@ -1753,7 +1918,13 @@ class PyBuildExt(build_ext): libraries=[], sources=sources, depends=depends) + if sys.platform in ['mingw', 'win32']: + ctypes_test_libs = ['oleaut32'] + else: + ctypes_test_libs = [] + ext_test = Extension('_ctypes_test', + libraries=ctypes_test_libs, sources=['_ctypes/_ctypes_test.c']) self.extensions.extend([ext, ext_test])