Merge alpha100 branch back to main trunk
diff --git a/Makefile.in b/Makefile.in
index 20a4acb..ca8d266 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,58 +1,256 @@
-MAKE=		make
+########################################################################
+# Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
+# Amsterdam, The Netherlands.
+# 
+#                         All Rights Reserved
+# 
+# Permission to use, copy, modify, and distribute this software and its 
+# documentation for any purpose and without fee is hereby granted, 
+# provided that the above copyright notice appear in all copies and that
+# both that copyright notice and this permission notice appear in 
+# supporting documentation, and that the names of Stichting Mathematisch
+# Centrum or CWI not be used in advertising or publicity pertaining to
+# distribution of the software without specific, written prior permission.
+# 
+# STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+# FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+# FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+########################################################################
 
-SUBDIRS=	Parser Grammar Objects Python
-SUBDIRSTOO=	Include Extensions readline
-DISTFILES=	README Makefile configure configure.in
-DIST=		$(DISTFILES) $(SUBDIRS) $(SUBDIRSTOO)
+# Toplevel Makefile for Python
+# Note -- if recursive makes fail, try adding MAKE=make
 
-all:		config.status
+# Substitutions by configure
+srcdir=		@srcdir@
+VPATH=		@srcdir@
+INSTALL=	@INSTALL@
+
+# Install prefixes are treated specially by the configure script:
+# it only changes these lines if it has received a --prefix=... or
+# --exec-prefix-... command line option, or if it has figured out
+# a value by searching for python in $PATH.  Note that $(prefix) is
+# also used when compiling config.c in Modules to set the default
+# module search path, so if you change it later be sure to change it
+# there too and rebuild.
+
+# Install prefix for architecture-independent files
+prefix=		/usr/local
+
+# Install prefix for architecture-dependent files
+exec_prefix=	$(prefix)
+
+# Programs
+SHELL=		/bin/sh
+
+# --with-PACKAGE options for configure script
+# e.g. --with-readline --with-svr5 --with-solaris --with-thread
+# (see README for an explanation)
+WITH=		
+
+# Compiler options passed to subordinate makes
+OPT=		-O
+
+# Subdirectories where to run make recursively
+SUBDIRS=	Parser Objects Python Modules
+
+# Other subdirectories
+SUBDIRSTOO=	Include Lib Doc Misc Demo readline Grammar
+
+# Files and directories to be distributed
+CONFIGFILES=	configure configure.in acconfig.h config.h.in Makefile.in
+DISTFILES=	README ChangeLog $(CONFIGFILES)
+DISTDIRS=	$(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
+DIST=		$(DISTFILES) $(DISTDIRS)
+
+# Default target
+all:		python
+
+# Build the interpreter
+python:		Makefiles
 		for i in $(SUBDIRS); do \
-			(echo $$i; cd $$i; $(MAKE) all); \
+			(echo $$i; cd $$i; $(MAKE) OPT="$(OPT)" all); \
 		done
 
-tags:		ctags -t Parser/*.[ch] Objects/*.[ch] Python/*.[ch] Include/*.h
+# Test the interpreter (twice, once without .pyc files, once with)
+TESTPATH=	$(srcdir)/Lib:$(srcdir)/Lib/test
+test:		python
+		-rm -f $(srcdir)/Lib/test/*.pyc
+		PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
+		PYTHONPATH=$(TESTPATH) ./python -c 'import autotest'
 
-TAGS:		etags -t Parser/*.[ch] Objects/*.[ch] Python/*.[ch] Include/*.h
+# Install the interpreter
+install:	python
+		$(INSTALL) python $(exec_prefix)/bin/python
+		@echo If this is your first time, consider make libinstall...
 
+# Install the library.
+# If your system does not support "cp -r", try "copy -r" or perhaps
+# something like find Lib -print | cpio -pacvdmu $(DESTDIR)/lib/python
+libinstall:
+		-if test ! -d $(prefix)/lib/python; \
+		then mkdir $(prefix)/lib/python; \
+		fi
+		cp -r $(srcdir)/Lib/* $(prefix)/lib/python
+		@echo Ideally, run something to compile all modules now...
+
+# install the manual page
+maninstall:
+		$(INSTALL) $(srcdir)/Misc/python.man \
+			$(prefix)/man/man1/python.1
+
+# install the include files
+INCLUDEPY=	$(prefix)/include/Py
+inclinstall:
+		-if test ! -d $(INCLUDEPY); \
+		then mkdir $(INCLUDEPY); \
+		fi
+		cp $(srcdir)/Include/*.h $(INCLUDEPY)
+
+# install the lib*.a files and miscellaneous stuff needed by extensions
+LIBP=		$(exec_prefix)/lib/python
+LIBPL=		$(LIBP)/lib
+libainstall:	all
+		-if test ! -d $(LIBP); \
+		then mkdir $(LIBP); \
+		fi
+		-if test ! -d $(LIBPL); \
+		then mkdir $(LIBPL); \
+		fi
+		for i in $(SUBDIRS); do \
+			echo $$i; $(INSTALL) $$i/lib$$i.a $(LIBPL)/lib$$i.a; \
+		done
+		$(INSTALL) Modules/config.c $(LIBPL)/config.c
+		$(INSTALL) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in
+		$(INSTALL) Modules/Makefile $(LIBPL)/Makefile
+		$(INSTALL) Modules/Setup $(LIBPL)/Setup
+		$(INSTALL) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup
+		$(INSTALL) config.h $(LIBPL)/config.h
+		$(INSTALL) $(srcdir)/Python/frozenmain.c $(LIBPL)/frozenmain.c
+
+# Build the sub-Makefiles
+Makefiles:	config.status
+		(cd Modules; $(MAKE) -f Makefile.pre Makefile)
+		for i in . $(SUBDIRS); do \
+			(echo $$i; cd $$i; $(MAKE) Makefile); \
+		done
+
+# Build the toplevel Makefile
+Makefile:	Makefile.in config.status
+		CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status
+
+# Run the configure script.  If config.status already exists,
+# call it with the --recheck argument, which reruns configure with the
+# same options as it was run last time; otherwise run the configure
+# script with options taken from the $(WITH) variable
+config.status:	$(srcdir)/configure
+		if test -f config.status; \
+		then $(SHELL) config.status --recheck; \
+		else $(SHELL) $(srcdir)/configure $(WITH); \
+		fi
+
+.PRECIOUS:	config.status python
+
+# Rerun configure with the same options as it was run last time,
+# provided the config.status script exists
+recheck:
+		$(SHELL) config.status --recheck
+
+# Rebuild the configure script from configure.in; also rebuild config.h.in
+autoconf:
+		(cd $(srcdir); autoconf; autoheader)
+
+# Create a tags file for vi
+tags::
+		ctags -w -t Include/*.h
+		for i in $(SUBDIRS); do ctags -w -t -a $$i/*.[ch]; done
+		sort tags -o tags
+
+# Create a tags file for GNU Emacs
+TAGS::
+		etags -t Include/*.h
+		for i in $(SUBDIRS); do etags -t -a $$i/*.[ch]; done
+
+# Add dependencies to sub-Makefiles
 depend:
 		for i in $(SUBDIRS); do \
 			(echo $$i; cd $$i; $(MAKE) depend); \
 		done
 
+# Sanitation targets -- clean leaves libraries, executables and tags
+# files, which clobber removes those as well
+
 localclean:
 		-rm -f core *~ [@,#]* *.old *.orig *.rej
-		-(cd Include; rm -f core *~ [@,#]* *.old *.orig *.rej)
 
 clean:		localclean
 		-for i in $(SUBDIRS); do \
-			(echo $$i; cd $$i; $(MAKE) clean); \
+			(echo $$i; cd $$i; \
+			 if test -f Makefile; \
+			 then $(MAKE) clean; \
+			 else $(MAKE) -f Makefile.*in clean; \
+			 fi); \
 		done
 
 localclobber:	localclean
-		-rm -f tags TAGS config.status
+		-rm -f tags TAGS python
 
 clobber:	localclobber
 		-for i in $(SUBDIRS); do \
-			(echo $$i; cd $$i; $(MAKE) clobber); \
+			(echo $$i; cd $$i; \
+			 if test -f Makefile; \
+			 then $(MAKE) clobber; \
+			 else $(MAKE) -f Makefile.in clobber; \
+			 fi); \
 		done
 
+# Make things extra clean, before making a distribution
 distclean:	clobber
-		-for i in $(SUBDIRS); do \
-			if test -f $$i/Makefile.in; then \
-				rm -f $$i/Makefile; \
-			fi; \
+		-$(MAKE) SUBDIRS="$(SUBDIRSTOO)" clobber
+		-rm -f config.status config.h Makefile
+		-for i in $(SUBDIRS) $(SUBDIRSTOO); do \
+			 for f in $$i/*.in; do \
+				f=`basename "$$f" .in`; \
+			 	if test "$$f" != "*"; then \
+					echo rm -f "$$i/$$f"; \
+				 	rm -f "$$i/$$f"; \
+				fi; \
+			 done; \
 		done
 
-Makefiles:	config.status
-		./config.status
+# Find files with funny names
+find:
+		find $(DISTDIRS) -type d \
+			-o -name '*.[chs]' \
+			-o -name '*.py' \
+			-o -name '*.doc' \
+			-o -name '*.sty' \
+			-o -name '*.bib' \
+			-o -name '*.dat' \
+			-o -name '*.el' \
+			-o -name '*.fd' \
+			-o -name '*.in' \
+			-o -name '*.tex' \
+			-o -name '*,[vpt]' \
+			-o -name 'Setup' \
+			-o -name 'Setup.*' \
+			-o -name README \
+			-o -name Makefile \
+			-o -name ChangeLog \
+			-o -name RCS \
+			-o -name Repository \
+			-o -name Entries \
+			-o -name Tag \
+			-o -name tags \
+			-o -name TAGS \
+			-o -name .cvsignore \
+			-o -name MANIFEST \
+			-o -print
 
-config.status:	configure
-		./configure
-
-configure:	configure.in
-		autoconf
- 
-tar:		dist.tar.Z
-
-dist.tar.Z:	$(DIST)
+# Build a distribution tar file (run make distclean first)
+# (This leaves the RCS and CVS directories in :-( )
+tar:
 		tar cf - $(DIST) | compress >dist.tar.Z
diff --git a/README b/README
index e5ea873..9e19f2f 100644
--- a/README
+++ b/README
@@ -1,63 +1,412 @@
-This is an ALPHA release of Python 1.0 for UNIX.  Currently it builds
-a rather minimal executable and requires that you already have Python
-0.9.9 (or at least its library).
+Python release 1.0.3
+====================
 
-Instructions for building:
+==> This is patch number 3 to Python 1.0, bumping its version string
+    to 1.0.3.  It consists almost entirely of essential bug fixes to
+    the C sources.  See the file Misc/NEWS for a description of what's
+    new in this patch (as well as what's new in 1.0).
 
-(1) Run the configure shell script:
+==> Python 1.0 is the first "official" Python release in more than
+    half a year.  It's significantly improved over version 0.9.9, both
+    at the functionality level and (especially) in portability of the
+    source -- you should now be able to configure build this without
+    manual intervention on almost any type of Unix system.  It is
+    known to work at least on IRIX 4 and 5, SunOS 4, Solaris 2, HP-UX,
+    Ultrix, OSF/1, AIX, SCO ODT 3.0, Minix, Linux, SEQUENT, and
+    through the use of automatic feature detection should work on most
+    other Unix flavors as well.  Binaries are available for Macintosh
+    and PC platforms (for DOS, DOS w/ 32-bit extender, Windows, and
+    Windows NT).
 
-	./configure
+==> If you don't know yet what Python is: it's an interpreted,
+    extensible, embeddable, interactive, object-oriented programming
+    language.  For a quick summary of what Python can mean for a
+    UNIX/C programmer, read Misc/BLURB.LUTZ.
 
-This may take a minute or two -- it does a rather thorough
-investigation of your system to find out many compile-time flags.  It
-prints messages but does not ask questions.  When finished, it will
-create config.status in the current directory, as well as Makefile in
-each of the subdirectories Parser, Objects and Python.  Note that
-unless you have the CC shell environment variable set to the name of
-your C compiler, it will attempt to find the GNU C compiler (gcc) and
-use it if it finds it.  On some systems a broken gcc may be installed;
-put CC=cc in the environment to override it.  On some systems it may
-be interesting to compare both compilers.  (Note: the Makefile has
-been rigged in such a way that it will run configure if you haven't
-done so.)
+==> If you want to start compiling right away: just type "./configure"
+    in the current directory and when it finishes, type "make".  See
+    the section Build Instructions below for more details.
 
-(2) Run Make:
+==> All documentation is in the subdirectory Doc in the form of LaTeX
+    files.  In order of importance for new users: Tutorial (tut),
+    Library Reference (lib), Language Reference (ref), Extending
+    (ext).  Note that especially the Library Reference is of immense
+    value since much of Python's power (including the built-in data
+    types and functions!) is described there.  [XXX The ext document
+    has not been updated to reflect this release yet.]
 
-	make
+==> Python is COPYRIGHTED but free to use for all.  See the copyright
+    notice at the end of this file.
 
-This will recursively run Make in each of the Parser, Grammar, Objects
-and Python subdirectories.  In Parser it builds an executable "pgen"
-and a library libParser.a.  In Grammar it runs Parser/pgen to generate
-graminit.[ch] which are copied to Includes and Python, respectively.
-In Objects it builds a library libObjects.a.  In Python it builds a
-library libPython.a and an executable "python".
 
-(3) Test the resulting executable:
+Build instructions
+------------------
 
-	Python/python -c 'import testall'
+Before you start building Python, you must first configure it.  This
+entails (at least) running the script "./configure", which figures out
+your system configuration and creates several Makefiles.  (This will
+take a minute or two -- please be patient!)  When it is done, you are
+ready to run make.  Typing "make" in the toplevel directory will
+recursively run make in each of the subdirectories Parser, Objects,
+Python and Modules, creating a library file in each one.  The
+executable of the interpreter is built in the Modules subdirectory but
+moved up here when it is built.  If you want or need to, you can also
+chdir into each subdirectory in turn and run make there manually
+(do the Modules subdirectory last!).  If you run into trouble, first
+see the section Troubleshooting later in this file.
 
-For now, this will assume that you have a working version of Python
-release 0.9.9 installed in /usr/local (it uses the Python library from
-/usr/local/lib/python) or that your PYTHONPATH shell environment
-variable points to the 0.9.9 Python library.
+EXCEPTIONS: on SVR4 derived systems, you need to pass the configure
+script the option --with-svr4.  See below for more options you can
+pass to the configure script.
 
-(4) Optionally: read Extensions/README and try to build a Python with
-all the  extensions that make sense on your system.  (Note: some
-extensions are not supported yet.)
+AIX users: read the file Misc/AIX-NOTES before trying to build.
 
-(5) Give feedback:
+Minix users: when using ack, use "CC=cc AR=aal RANLIB=: ./configure"!
 
-	Mail guido@cwi.nl
+You can configure the interpreter to contain fewer or more built-in
+modules by editing the file Modules/Setup.  This file is initially
+copied (when the toplevel Makefile makes Modules/Makefile for the
+first time) from Setup.in; if it does not exist yet, make a copy
+yourself.  Never edit Setup.in -- always edit Setup.  Read the
+comments in the file for information on what kind of edits you can
+make.  When you have edited Setup, Makefile and config.c in Modules
+will automatically be rebuilt the next time you run make in the
+toplevel directory.  (There are some example Setup files which you may
+copy to Setup for specific systems; have a look at Setup.*.)
 
-Please tell me whether the build succeeded or not.  If you needed to
-edit *any* file, tell me which file, why and how (send me a diff or a
-copy of the modified file if you can).  If you get stuck, please send
-me the error output.  Don't forget to mention the operating system,
-compiler and hardware version that you used, e.g. "Solaris 2.2 with
-gcc version cygnus-2.0.2 on a dual processor Sparcstation 10" or "IRIX
-5.1 with standard cc on an Indigo XS-24 with R4000 CPU".  If you can
-build the core interpreter but get stuck building an extended version,
-let me know which extensions gave problems and how.
+If you want to change the optimization level of the build, assign to
+the OPT variable on the toplevel make command; e.g. "make OPT=-g" will
+build a debugging version of Python on most platforms.
+
+To test the interpreter that you have just built, type "make test".
+This runs the test set silently, twice (once with no compiled files,
+once with the compiled files left by the previous test run).  Each
+test run should print "All tests OK." and nothing more.  (The test set
+does not test the built-in modules, but will find most other problems
+with the interpreter.)
+
+To install the interpreter as /usr/local/bin/python, type "make
+install".  To install the library as /usr/local/lib/python, type "make
+libinstall".  To install the manual page as
+/usr/local/man/man1/python.1, type "make maninstall".  To install the
+Emacs editing mode for python, manually copy the file
+Misc/python-mode.el to your local Emacs lisp directory.  The directory
+/usr/local can be overridden at configuration time by passing
+--prefix=DIRECTORY to the configure script, or at make time by passing
+"prefix=DIRECTORY" to make.  See below for more information on --prefix.
+
+If you plan to do development of extension modules or to embed Python
+in another application and don't want to reference the original source
+tree, you can type "make inclinstall" and "make libainstall" to
+install the include files and lib*.a files, respectively, as
+/usr/local/include/Py/*.h and /usr/local/lib/python/lib/lib*.a.  The
+make libainstall target also installs copies of several other files
+used or produced during the build process which are needed to build
+extensions or to generate their Makefiles.
+
+To print the documentation, cd into the Doc subdirectory, type "make"
+(let's hope you have LaTeX installed!), and send the four resulting
+PostScript files (tut.ps, lib.ps, ref.ps, and ext.ps) to the printer.
+See the README file there; you can also build a texinfo version of the
+library manual and from that construct an Emacs info version (the
+hypertext format used by the Emacs "info" command) and an HTML version
+(the hypertext format used by the World Wide Web distributed
+information initiative).  You don't need to have LaTeX installed for
+this.  Note that the Python archive sites also carry the resulting
+PostScript files, in case you have a PostScript printer but not LaTeX.
+
+Some special cases are handled by passing environment variables or
+options to the configure script:
+
+- The configure script uses gcc (the GNU C compiler) if it finds it.
+If you don't want this, or if this compiler is installed but broken on
+your platform, pass "CC=cc" (or whatever the name of the proper C
+compiler is) in the environment.
+
+- On System V, Release 4 derived systems (e.g. SOLARIS 2, but not
+IRIX 5) you need to call the configure script with the option
+--with-svr4.  This is needed so the libraries -lnsl and -lsocket are
+found.  (On some other systems, e.g. IRIX 5, these libraries exist but
+are incompatible with other system libraries such as X11 and GL.)
+
+- If you want to install the binaries and the Python library somewhere
+else than in /usr/local/{bin,lib}, you can pass the option
+--prefix=DIRECTORY; the interpreter binary will be installed as
+DIRECTORY/bin/python and the library files as DIRECTORY/lib/python/*.
+If you pass --exec-prefix=DIRECTORY (as well) this overrides the
+installation prefix for architecture-dependent files (like the
+interpreter binary).  Note that --prefix=DIRECTORY also affects the
+default module search path (sys.path), when Modules/config.c is
+compiled.  Passing make the option prefix=DIRECTORY (and/or
+exec_prefix=DIRECTORY) overrides the prefix set at configuration time;
+this may be more convenient than re-running the configure script if
+you change your mind about the install prefix...
+
+- You can use the GNU readline library to improve the interactive
+user interface: this gives you line editing and command history when
+calling python interactively.  You need to build the GNU readline
+library before running the configure script.  Its sources are
+distributed with Python.  This may involve some editing of the
+Makefile there -- I'm sorry, but I don't feel responsible for making
+it more portable or adapting it to autoconf...  Pass the configure
+script the option --with-readline=DIRECTORY where DIRECTORY is the
+absolute pathname of the directory where you've built the readline
+library.  A known problem with the readline library is that it
+contains entry points which cause conflicts with the STDWIN and SGI GL
+libraries.  The stdwin conflict can be solved (and will be, in some
+future release of stdwin) by adding a line saying '#define werase
+w_erase' to the stdwin.h file (in the stdwin distribution,
+subdirectory H).  The GL conflict may be solvable by reordering the -l
+options on the final link command, but it appears unsafe...  Another
+hint: you may have to add -Dindex=strchr -Drindex=strrchr to
+readline's CFLAGS if your system doesn't have index and rindex.
+
+- On SGI IRIX, and on Sun SOLARIS 2, you can use multiple threads.  To
+enable this, pass --with-thread.  In the Modules/Setup file, enable
+the thread module.  (Threads aren't enabled automatically because
+there are run-time penalties when support for them is compiled in even
+if you don't use them.)
+
+- On SGI IRIX, there are modules that interface to many SGI specific
+system libraries, e.g. the GL library and the audio hardware.  To
+enable these modules, you must edit the Modules/Setup file (or copy the
+Setup.irix4 file to it).
+
+- On SGI IRIX 4, dynamic loading of extension modules is supported by
+the "dl" library by Jack Jansen, which is ftp'able from
+ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.  This is enabled (after
+you've ftp'ed and compiled the dl library!) by passing
+--with-sgi-dl=DIRECTORY where DIRECTORY is the absolute pathname of
+the dl library.  (Don't bother on IRIX 5, it already has dynamic
+linking using SunOS style shared libraries.)
+
+- Dynamic loading of modules is rumoured to be supported on some other
+systems: VAX (Ultrix), Sun3 (SunOS 3.4), Sequent Symmetry (Dynix), and
+Atari ST.  This is done using a combination of the GNU dynamic loading
+package (ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z) and an
+emulation of the SGI dl library mentioned above (the emulation can be
+found at ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z).  To enable
+this, ftp and compile both libraries, then call the configure passing
+it the option --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY where
+DL_DIRECTORY is the absolute pathname of the dl emulation library and
+DLD_DIRECTORY is the absolute pathname of the GNU dld library.  (Don't
+bother on SunOS 4 or 5, they already have dynamic linking using shared
+libraries.)
+
+- It is possible to specify alternative versions for the Math library
+(default -lm) and the C library (default the empty string) using the
+options --with-libm=STRING and --with-libc=STRING, respectively.  E.g.
+if your system requires that you pass -lc_s to the C compiler to use
+the shared C library, you can pass --with-libc=-lc_s.  These libraries
+are passed after all other libraries, the C library last.
+
+You can also build an "extended" interpreter, using modules that are
+not contained in the Modules directory.  Extensions are distributed as
+a separate tar file (currently extensions.tar.Z).  See the README file
+there.
+
+
+Building for multiple architectures (using the VPATH feature)
+-------------------------------------------------------------
+
+If your file system is shared between multiple architectures, it
+usually is not necessary to make copies of the sources for each
+architecture you want to support.  If the make program supports the
+VPATH feature, you can create an empty build directory for each
+architecture, and in each directory run the configure script (on the
+appropriate machine with the appropriate options).  This creates the
+necessary subdirectories and the Makefiles therein.  The Makefiles
+contain a line VPATH=... which points to directory containing the
+actual sources.
+
+For example, the following is all you need to build a minimal Python
+in /usr/tmp/python (assuming ~guido/src/python is the toplevel
+directory and you want to build in /usr/tmp/python):
+
+	$ mkdir /usr/tmp/python
+	$ cd /usr/tmp/python
+	$ ~guido/src/python/configure
+	[...]
+	$ make
+	[...]
+	$
+
+To use the readline library in this case, you will have to create a
+subdirectory of your build directory called readline, copy
+readline/Makefile into it, edit the Makefile to contain a proper VPATH
+line (and possibly edit the compiler flags set in the Makefile), and
+pass the configure script a --with-readline=DIRECTORY option giving it
+the absolute (!) pathname of the readline build directory.
+
+Note that Modules/Makefile copies the original Setup file to the build
+directory if it finds no Setup file there.  This means that you can
+edit the Setup file for each architecture independently.  For this
+reason, subsequent changes to the original Setup file are not tracked
+automatically, as they might overwrite local changes.  To force a copy
+of a changed original Setup file, delete the target Setup file.  (The
+makesetup script supports multiple input files, so if you want to be
+fancy you can change the rules to create an empty Setup.local if it
+doesn't exist and run it with arguments $(srcdir)/Setup Setup.local;
+however this assumes that you only need to add modules.)
+
+
+Troubleshooting
+---------------
+
+Here is a selection from the FAQ on various common problems.
+
+3.6. Q. Link errors building Python with STDWIN on SGI IRIX.
+
+A. Rebuild STDWIN, specifying "CC=cc -cckr" in the Makefile.
+
+3.8. Q. Link errors after rerunning the configure script.
+
+A. It is generally necessary to run "make clean" after a configuration
+change.
+
+3.9. Q. The python interpreter complains about options passed to a
+script (after the script name).
+
+A. You are probably linking with GNU getopt, e.g. through -liberty.
+Don't.  (If you are using this because you link with -lreadline, use
+the readline distributed with Python instead.)
+
+3.10. Q. When building on the SGI, make tries to run python to create
+glmodule.c, but python hasn't been built or installed yet.
+
+A. Comment out the line mentioning glmodule.c in Setup and build a
+python without gl first; install it or make sure it is in your $PATH,
+then edit the Setup file again to turn on the gl module, and make
+again.  You don't need to do "make clean"; you do need to run "make
+Makefile" in the Modules subdirectory (or just run "make" at the
+toplevel).
+
+3.13. Q. Other trouble building Python 1.0.2 on platform X.
+
+A. Please email the details to <guido@cwi.nl> and I'll look into it.
+
+
+Building on non-UNIX systems
+----------------------------
+
+On non-UNIX systems, you will have to fake the effect of running the
+configure script manually.  A good start is to copy the file
+config.h.in to config.h and edit the latter to reflect the actual
+configuration of your system.  Most symbols must simply be defined as
+1 only if the corresponding feature is present and can be left alone
+otherwise; however RETSIGTYPE must always be defined, either as int or
+as void, and the *_t type symbols must be defined as some variant of
+int if they need to be defined at all. Then arrange that the symbol
+HAVE_CONFIG_H is defined during compilation (usually by passing an
+argument of the form `-DHAVE_CONFIG_H' to the compiler, but this is
+necessarily system-dependent).
+
+
+Distribution structure
+----------------------
+
+Most subdirectories have their own README file.  Most files have
+comments.
+
+ChangeLog	A raw list of changes since the first 1.0.0 BETA release
+Contrib/	Contributed code
+Demo/		Demonstration scripts, modules and programs
+Demo2/		Some more demonstrations (not distributed)
+Doc/		Documentation (in LaTeX)
+Ext-dummy/	Placeholder for Extensions in the distribution
+Extensions/	Extension modules (not distributed)
+Grammar/	Input for the parser generator
+Include/	Public header files
+Lib/		Python library modules
+Makefile	Rules for building the distribution
+Misc/		Miscellaneous files
+Modules/	Implementation of most built-in modules
+Objects/	Implementation of most built-in object types
+Parser/		The parser and tokenizer and their input handling
+Python/		The "compiler" and interpreter
+README		The file you're reading now
+acconfig.h	Additional input for the autoheader program
+config.h	Configuration header (generated)
+config.h.in	Source from which config.status creates config.h
+config.status	status from last run of configure script (generated)
+configure	Configuration shell script (GNU autoconf output)
+configure.in	Configuration specification (GNU autoconf input)
+tags, TAGS	Tags files for vi and Emacs (generated)
+python		The executable interpreter (generated)
+readline/	Source code for the GNU readline library
+
+
+Ftp access
+----------
+
+The latest Python source distribution can be ftp'ed from site
+ftp.cwi.nl, directory /pub/python, file python<version>.tar.Z.  You
+can also find PostScript of the main Python documentation there,
+Macintosh and PC binaries, and the latest STDWIN source distribution
+(in directory /pub/stdwin).  Mirror sites are gatekeeper.dec.com
+(/pub/plan/python/cwi), ftp.wustl.edu
+(/graphics/graphics/sgi-stuff/python) and ftp.uu.net
+(/languages/python) -- try these sites first if you are on the US
+continent, or at least closer to it than to Europe.  These mirror
+sites are at most a day behind on the European archive!
+
+If you don't have ftp access, send mail containing only the word HELP
+to ftpmail@decwrl.dec.com or bitftp@pucc.princeton.edu, and the
+server will send you instructions on how to make requests.
+
+
+Mailing list
+------------
+
+There is a mailing list devoted to Python programming, design and
+bugs.  To subscribe, send mail containing your real name and e-mail
+address in Internet form to "python-list-request@cwi.nl".  If you have
+built and installed Python, you are urgently to subscribe to this
+mailing list.
+
+
+Author
+------
+
+Guido van Rossum
+CWI, dept. CST
+P.O. Box 94079
+1090 GB  Amsterdam
+The Netherlands
+
+E-mail: Guido.van.Rossum@cwi.nl
+
+
+Copyright Notice
+----------------
+
+The Python source is copyrighted, but you can freely use and copy it
+as long as you don't change or remove the copyright:
+
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the names of Stichting Mathematisch
+Centrum or CWI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+Signature
+---------
 
 --Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
 URL:  <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>
diff --git a/TODO b/TODO
index 0f54399..b7c3036 100644
--- a/TODO
+++ b/TODO
@@ -1,17 +1,236 @@
-CVS committal...
-renaming project?  (promised but not even started yet!)
-better way to specify PYTHONPATH
-improve 'install' targets in toplevel Makefile
-Add Demo directory again
-Add NEWS and HISTORY to Misc directory
-fix compilation warnings
-non-Sun dynamic linking (SGI 4 dl, and dl-dld elsewhere)
-put some stuff into Contrib dir
-make freeze script working again (use Extensions/mkext.py as a base?)
-write porting guide
-update documentation (especially ext.tex!)
-test set?
-.
-.
-.
-release!
+(*) int*int overflow check shouldn't doubles on alpha (cf. John Tromp's mail)
+
+(*) add signal.alarm()
+
+(*) when abort()ing because of unexpected exception, print a message
+    first (Jack)
+
+----------------------------------------------------------------------
+(from BUGS1.0.1)
+----------------------------------------------------------------------
+document addpack, urllib, ...
+
+(*) import.c from JaapV
+
+document os.exec*
+
+name sunaudiodevmodule.c is too long
+
+(*) play with / include SUIT interface
+
+make regsub.[g]sub() optionally case insensitive
+
+handle printing of errors in lines containing multiline strings
+
+======================================================================
+
+(*) ought to use features from autoconf 1.8
+
+(*) errors in __repr__() are handled wrong when called from format
+
+- long(0x80000000) has wrong value!
+
+- hex(0x80000000) shouldn't have sign (?)
+
+(*) need way to set buffering at file open time
+
+(*) need way to force stdout unbuffered
+
+- document new modules (builtin as well as Lib)
+
+- restart CVS tree
+
+(?) build shared libs for SunOS 4.1.3
+
+- Mac X... code resources as shared libs?
+
+(*) X patches from Adrian Phillips
+
+(*) Jaap's freeze script
+
+Incorporate with contrib status:
+- additions to glmodule by rg3h
+(*) Jaap's posixfile module (with locking)
+(*) pthreads interface
+
+Later:
+- put the offending object in IOError and posix.error
+- make module marshal work with user-defined file-like objects
+- built-in help?
+- hierarchical module names?
+
+Big plans:
+
+- allow separate interpreters (a la Xt's Applocation Contexts, and Tcl)
+- great renaming
+- complete reflexive nature of the language, e.g. have interfaces et
+create any kind of object
+(*) GUI interface a la Tk
+
+
+======================================================================
+For FAQ:
+
+(*) why don't strings (numbers, tuples, ...) have methods / attributes
+
+(*) why are strings / numbers / tuples immutable
+
+why don't list methods return self
+
+======================================================================
+PM/TODO list after Egypt (from mailing list):
+
+make .pyc files executable (how?)
+
+thread status and improvements (lock stmt; signal/wait)
+
+optional optimizations
+
+pthread migration
+
+(*) test/incorporate new SUIT
+
+shorten excessively long filenames (sunaudiodevmodule.c)
+
+(*) default parameter values
+
+multiple interpreter objects
+
+(*) import shlib bug (irix5.2) (reload, dlclose)
+
+(*) addpack.py
+
+(*) newmodule.c (or other hacks to create new modules, classes, functions
+    etc. from their components)
+
+persistency
+
+new Dbhash.py, dbhash library
+
+reraise; or raise 3rd param for traceback?
+-or- except type, value, tbackobjec
+
+redesign exceptions from scratch?
+
+dbm objects miss items(), values() methods
+
+(*) jar's new profile
+
+answer q about coerce()
+
+(*) reconsider pass [expression] ??? -or- don't print non-interactive
+    exprs -or- option to suppress printing non-None expressions
+
+(*) should be able to hash code objs (add fns to convert between lists/tuples)
+
+describe() ?
+
+distribute demo2 with Holmes
+
+(*) re-reply on try-continue
+
+classes are too slow
+
+add += etc. ?
+
+optimize tuple = tuple
+
+allow (a, b) = [1, 2] and [1, 2] = (1, 2) ???
+
+wustl is not un the northwest of the US?
+
+(*) MPW doesn't like \000 in string literals?
+
+MPW patches, unixemu patches
+
+prepare tar files with
+	- mac think projects (*)
+	- mpw makefiles
+	- dos makefiles
+	- mac unixemu lib
+
+explain rules about == vs. 'is' for strings (* by others on the list)
+
+(*) bug in ceval.c DELETE_FAST
+
+(*) possible optimize LOAD_NAME -> LOAD_GLOBAL
+
+get dos python with suit (inesc)
+
+(*) docs for try/continue are wrong and unclear
+
+better hashing fn?
+
+(*) add improved nested indent to python-mode.el
+
+(*) add a section to tutorial on "new" features
+
+rewrite section on formatting in tutorial
+
+======================================================================
+TODO-TOO list:
+
+test for overflow when converting python long to float
+
+lift restrictions on tuple or list in many cases
+
+(*) allow long ints with sensible values for getargs "i"
+
+(*) multiline string literals
+
+what to do about 64-bit int literals (on 64-bit machines) in .pyc
+files?  (Currently truncated w/o warning!)
+
+DOCUMENTATION UPDATE!  E.g. ref.tex doesn't describe:
+(*)	- line joins w/o backslash
+(*)	- double-quoted strings; \" in strings
+	- more?
+Should double-check all changes with docs!
+
+(?) Interrupting output still sometimes doesn't call clearerr() properly
+
+sometimes ghost errors when interrupting during debugging in
+'continue' mode?
+
+typing a comment to a primary prompt shouldn't issue a secondary prompt
+
+readline: add hooks to recognize Python syntax and to expand Python
+commands and names
+
+should have absolute pathnames in function objects
+
+in general check that all the exceptions are modernized and that the
+messages aren't giving the same error twice (e.g., stdwinmodule.c!)
+
+- check read/write allowed for file objects
+
+- introduce macros to set/inspect errno for syscalls, to support things
+  like getoserr()
+
+======================================================================
+DOS/Windows Python
+
+(???) command line options?
+
+(*) os.system()
+
+(???) interrupts
+
+(???) wrap
+
+(*) pc module
+
+(*) dospath.py
+
+DOS/Windows Python -- TO DO
+
+(*) memtest from config.h
+
+(*) copy sources back
+
+(*) build DOS version
+
+(*) distribute 386 version
+
+(*) Mac 1.0.1 release?
+======================================================================
diff --git a/configure.in b/configure.in
index f70eb72..3e0aabf 100644
--- a/configure.in
+++ b/configure.in
@@ -1,10 +1,27 @@
-dnl Process this file with autoconf to produce a configure script.
-
+dnl Process this file with autoconf 1.8 or later to produce a configure script.
+AC_REVISION($Revision$)dnl
+AC_PREREQ(1.8)dnl
 AC_INIT(Include/object.h)
+AC_PREFIX(python)
+AC_CONFIG_HEADER(config.h)dnl
+# Don't suppress compiler output when --verbose is specified
+test -n "$verbose" &&
+	ac_compile=`echo "$ac_compile" | sed "s|>/dev/null 2>&1||"`
+AC_VERBOSE(setting ac_compile to '$ac_compile')
 
 # checks for alternative programs
+AC_CHECKING(for --with(out)-gcc)
+AC_WITH(gcc, [
+	case $withval in
+	no)	withval=cc;;
+	yes)	withval=gcc;;
+	esac
+	CC=$withval])
 AC_PROG_CC
+AC_PROG_INSTALL
 AC_PROG_RANLIB
+AC_SUBST(AR)
+AC_PROGRAMS_CHECK(AR, ar aal, ar)
 
 # checks for UNIX variants that set C preprocessor variables
 AC_AIX
@@ -12,14 +29,21 @@
 AC_MINIX
 dnl DYNIX test runs compile so must be last
 AC_DYNIX_SEQ
+AC_CHECKING(for NeXT)
+AC_TEST_PROGRAM([
+#ifdef _NEXT_SOURCE
+main() { exit(0); }
+#endif
+], AC_DEFINE(_POSIX_SOURCE))
 
 # checks for header files
 AC_STDC_HEADERS
-AC_HAVE_HEADERS(dlfcn.h signal.h stdarg.h unistd.h utime.h sys/param.h sys/select.h sys/times.h sys/utsname.h)
+AC_HAVE_HEADERS(dlfcn.h fcntl.h limits.h signal.h stdarg.h stdlib.h thread.h unistd.h utime.h sys/audioio.h sys/param.h sys/select.h sys/time.h sys/times.h sys/un.h sys/utsname.h)
 AC_DIR_HEADER
 
 # checks for typedefs
-AC_GETGROUPS_T
+AC_CHECKING(for clock_t in time.h)
+AC_HEADER_EGREP(clock_t, time.h, , AC_DEFINE(clock_t, long))
 AC_MODE_T
 AC_OFF_T
 AC_PID_T
@@ -29,43 +53,124 @@
 
 # checks for libraries
 AC_HAVE_LIBRARY(dl)
-LIBS="${LIBS} -L${READLINESRC-${PWD-${CWD-`pwd`}}/readline}"
-AC_HAVE_LIBRARY(readline)
-if test -n "${have_lib}"; then
-AC_HAVE_LIBRARY(termcap)
-fi
 
-# Check for IRIX or SOLARIS thread interface
-AC_HAVE_LIBRARY(mpc)
-if test -n "${have_lib}"; then
-DEFS="${DEFS} -DUSE_THREAD"
-LIBOBJS="${LIBOBJS} thread.o"
-fi
+AC_CHECKING(for --with-svr4)
+AC_WITH(svr4, [
+AC_HAVE_LIBRARY(socket)
+AC_HAVE_LIBRARY(inet)
+AC_HAVE_LIBRARY(nsl)
+])
 
-AC_HAVE_LIBRARY(thread)
-if test -n "${have_lib}"; then
-DEFS="${DEFS} -DUSE_THREAD"
-LIBOBJS="${LIBOBJS} thread.o"
+AC_CHECKING(for --with-readline)
+AC_WITH(readline, [AC_DEFINE(WITH_READLINE)
+if test -d "$withval"
+then LIBS="$LIBS -L$withval"
+else AC_ERROR(proper usage is --with-readline=DIRECTORY)
 fi
+termcap=
+AC_HAVE_LIBRARY(termcap, [termcap=termcap], [AC_HAVE_LIBRARY(termlib, [termcap=termlib])])
+if test ! -z "$termcap"
+then LIBS="$LIBS -lreadline"
+     # Avoid possible conflict between shared libraries termcap and gl
+     # on IRIX 5: both contain a routine called clear.
+     if test -f /usr/lib/lib$termcap.a
+     then LIBS="$LIBS /usr/lib/lib$termcap.a"
+     else LIBS="$LIBS -l$termcap"
+     fi
+else AC_ERROR(no working termcap/termlib, do not use --with-readline)
+fi])
+
+AC_CHECKING(for --with-thread)
+AC_WITH(thread, [
+if test -d "$withval"
+then LIBS="$LIBS -L$withval"
+fi
+AC_HAVE_LIBRARY(pthreads, [AC_DEFINE(WITH_THREAD)
+AC_DEFINE(_POSIX_THREADS)
+LIBS="$LIBS -lpthreads"
+LIBOBJS="$LIBOBJS thread.o"])
+AC_HAVE_LIBRARY(mpc, [AC_DEFINE(WITH_THREAD)
+LIBS="$LIBS -lmpc"
+LIBOBJS="$LIBOBJS thread.o"])
+AC_HAVE_LIBRARY(thread, [AC_DEFINE(WITH_THREAD)
+LIBS="$LIBS -lthread"
+LIBOBJS="$LIBOBJS thread.o"])
+])
+
+# -I${DLINCLDIR} is added to the compile rule for import.o
+AC_SUBST(DLINCLDIR)
+DLINCLDIR=/
+
+AC_CHECKING(for --with-sgi-dl)
+AC_WITH(sgi-dl, [AC_DEFINE(WITH_SGI_DL)
+dldir=$withval
+if test -d "$dldir"
+then LIBS="$LIBS -L$dldir"
+else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
+fi
+DLINCLDIR=${dldir}
+LIBS="$LIBS -ldl -lmld"])
+
+AC_CHECKING(for --with-dl-dld)
+AC_WITH(dl-dld, [AC_DEFINE(WITH_DL_DLD)
+dldir=`echo "$withval" | sed 's/,.*//'`
+dlddir=`echo "$withval" | sed 's/.*,//'`
+if test -d "$dldir" -a -d "$dlddir"
+then LIBS="$LIBS -L$dldir -L$dlddir"
+else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
+fi
+DLINCLDIR=${dldir}
+LIBS="$LIBS -ldl -ldld"])
 
 # checks for library functions
-AC_HAVE_FUNCS(clock ftime gettimeofday getpgrp getwd lstat readlink readline select setsid setpgid setpgrp siginterrupt symlink tcgetpgrp tcsetpgrp times uname waitpid)
-AC_REPLACE_FUNCS(dup2 getcwd strerror strtoul strtod memmove)
+AC_HAVE_FUNCS(chown clock dlopen ftime gettimeofday getpeername getpgrp getpid getwd link lstat nice readlink select setgid setuid setsid setpgid setpgrp setvbuf siginterrupt symlink tcgetpgrp tcsetpgrp times uname waitpid)
+AC_REPLACE_FUNCS(dup2 getcwd strerror memmove)
 AC_FUNC_CHECK(getpgrp, AC_COMPILE_CHECK([argument to getpgrp], [#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
 
 # checks for structures
 AC_TIME_WITH_SYS_TIME
 AC_STRUCT_TM
 AC_TIMEZONE
+AC_COMPILE_CHECK([whether we have altzone], [#include <time.h>], [return altzone;], AC_DEFINE(HAVE_ALTZONE))
+AC_COMPILE_CHECK([whether sys/select.h and sys/time.h may both be included], [
+#include <sys/types.h>
+#include <sys/select.h>
+#include <sys/time.h>
+], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME)])
 
 # checks for compiler characteristics
+
+AC_CHAR_UNSIGNED
+
 AC_CONST
-echo checking for prototypes
-AC_TEST_PROGRAM([int foo(int x){return 0;} int main(){return foo(10);}], AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=1)
+
+AC_COMPILE_CHECK([wheter we have signed char], [], [signed char c;], [], AC_DEFINE(signed, []))
+
+AC_CHECKING(for prototypes)
+AC_TEST_PROGRAM([
+int foo(int x) { return 0; }
+int main() { return foo(10); }
+], AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=1)
+
+AC_CHECKING(for variable length prototypes and stdarg.h)
+AC_TEST_PROGRAM([
+#include <stdarg.h>
+int foo(int x, ...) { return 0; }
+int main() { return foo(10, 11, 12); }
+], AC_DEFINE(HAVE_STDARG_PROTOTYPES) have_prototypes=1)
 if test "$have_prototypes"; then
-AC_COMPILE_CHECK(["bad exec* prototypes"], [#include <unistd.h>], [char *const*t;execve("@",t,t);], , AC_DEFINE(BAD_EXEC_PROTOTYPES))
+AC_COMPILE_CHECK(["bad exec* prototypes"], [#include <unistd.h>], [char **t;execve("@",t,t);], , AC_DEFINE(BAD_EXEC_PROTOTYPES))
 fi
 
+AC_CHECKING(for bad static forward)
+AC_TEST_PROGRAM([
+struct s { int a; int b; };
+static struct s foo;
+int foobar() { return !foo.a; }
+static struct s foo = { 1, 2 };
+main() { exit(foobar()); }
+], , AC_DEFINE(BAD_STATIC_FORWARD))
+
 # checks for system services
 # (none yet)
 
@@ -73,5 +178,20 @@
 AC_IRIX_SUN
 AC_XENIX_DIR
 
+# check for --with-libm=...
+AC_SUBST(LIBM)
+LIBM=-lm
+AC_WITH(libm, [if test "$withval" != yes
+then LIBM=$withval
+else AC_ERROR(proper usage is --with-libm=STRING)
+fi])
+
+# check for --with-libc=...
+AC_SUBST(LIBC)
+AC_WITH(libc, [if test "$withval" != yes
+then LIBC=$withval
+else AC_ERROR(proper usage is --with-libc=STRING)
+fi])
+
 # generate output files
-AC_OUTPUT(Objects/Makefile Parser/Makefile Python/Makefile)
+AC_OUTPUT(Makefile Objects/Makefile Parser/Makefile Python/Makefile Modules/Makefile.pre)