Merge alpha100 branch back to main trunk
diff --git a/Python/Makefile.in b/Python/Makefile.in
index 7340ed4..732ea86 100644
--- a/Python/Makefile.in
+++ b/Python/Makefile.in
@@ -9,19 +9,20 @@
 
 CC=		@CC@
 RANLIB=		@RANLIB@
+AR=		@AR@
+
 DEFS=		@DEFS@
 LIBOBJS=	@LIBOBJS@
 LIBS=		@LIBS@
+DLINCLDIR=	@DLINCLDIR@
 
 
 # === Other things that are customizable but not by configure ===
 
-TOP=		..
-INCLDIR=	$(TOP)/Py
-OPT=		-g
-CFLAGS=		$(OPT) -I$(INCLDIR) $(DEFS)
+INCLDIR=	$(srcdir)/../Include
+OPT=		-O
+CFLAGS=		$(OPT) -I$(INCLDIR) -I.. $(DEFS)
 
-AR=		ar
 MKDEP=		mkdep
 SHELL=		/bin/sh
 
@@ -29,52 +30,77 @@
 # === Fixed definitions ===
 
 OBJS=		\
-		arraymodule.o \
 		bltinmodule.o \
 		ceval.o cgensupport.o compile.o \
 		errors.o \
 		frozenmain.o \
 		getmtime.o graminit.o \
 		import.o \
-		marshal.o mathmodule.o modsupport.o \
-		parsermodule.o posixmodule.o pythonmain.o pythonrun.o \
-		regexmodule.o regexpr.o \
-		stropmodule.o structmember.o structmodule.o sysmodule.o \
-		timemodule.o traceback.o \
+		marshal.o modsupport.o mystrtoul.o \
+		pythonmain.o pythonrun.o \
+		sigcheck.o structmember.o sysmodule.o \
+		traceback.o \
 		version.o \
 		$(LIBOBJS)
 
 LIB=		libPython.a
 
-MYLIBS=		$(LIB) ../Objects/libObjects.a ../Parser/libParser.a
-
 SYSLIBS=	-lm
 
 
 # === Rules ===
 
-all:		$(LIB) python
+all:		$(LIB)
 
 $(LIB):		$(OBJS)
 		$(AR) cr $(LIB) $(OBJS)
 		$(RANLIB) $(LIB)
 
-python:		config.o $(MYLIBS)
-		$(CC) config.o $(MYLIBS) $(LIBS) $(SYSLIBS) -o python
-
-config.o:	Makefile
-
 clean:
 		-rm -f *.o core *~ [@,#]* *.old *.orig *.rej
 
 clobber:	clean
-		-rm -f *.a python tags TAGS
+		-rm -f *.a tags TAGS
 
-Makefile:	Makefile.in $(TOP)/config.status
-		CONFIG_FILES=Makefile $(SHELL) $(TOP)/config.status
+Makefile:	$(srcdir)/Makefile.in ../config.status
+		(cd ..; CONFIG_FILES=Python/Makefile CONFIG_HEADERS= \
+		$(SHELL) config.status)
 
-depend:		$(SRCS)
-		$(MKDEP) $(CFLAGS) $(SRCS) $(PGENSRCS)
+import.o:	import.c
+		$(CC) $(CFLAGS) -I$(DLINCLDIR) -c $(srcdir)/import.c
+
+depend:
+		$(MKDEP) $(CFLAGS) `echo $(OBJS) | tr ' ' '\012' | \
+					sed 's|\(.*\)\.o|$(srcdir)/\1.c|'`
+
+.PRECIOUS:	Makefile
+
+bltinmodule.o: bltinmodule.c
+ceval.o: ceval.c
+cgensupport.o: cgensupport.c
+compile.o: compile.c
+dup2.o: dup2.c
+errors.o: errors.c
+fmod.o: fmod.c
+frozenmain.o: frozenmain.c
+getcwd.o: getcwd.c
+getmtime.o: getmtime.c
+graminit.o: graminit.c
+import.o: import.c
+marshal.o: marshal.c
+memmove.o: memmove.c
+modsupport.o: modsupport.c
+mystrtoul.o: mystrtoul.c
+pythonmain.o: pythonmain.c
+pythonrun.o: pythonrun.c
+sigcheck.o: sigcheck.c
+strerror.o: strerror.c
+strtod.o: strtod.c
+structmember.o: structmember.c
+sysmodule.o: sysmodule.c
+thread.o: thread.c
+traceback.o: traceback.c
+version.o: version.c
 
 # DO NOT DELETE THIS LINE -- mkdep uses it.
 # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
diff --git a/Python/dup2.c b/Python/dup2.c
index 85ec5d5..ee1a7ad 100644
--- a/Python/dup2.c
+++ b/Python/dup2.c
@@ -20,12 +20,17 @@
 int fd1, fd2;
 {
 	if (fd1 != fd2) {
+#ifdef MPW
+		close (fd2); /* XXX RJW MPW does not implement F_GETFL but it does have dup */
+		fd2 = dup(fd1);
+#else
 		if (fcntl(fd1, F_GETFL) < 0)
 			return BADEXIT;
 		if (fcntl(fd2, F_GETFL) >= 0)
 			close(fd2);
 		if (fcntl(fd1, F_DUPFD, fd2) < 0)
 			return BADEXIT;
+#endif
 	}
 	return fd2;
 }
diff --git a/Python/getmtime.c b/Python/getmtime.c
index 931da64..fa2fd02 100644
--- a/Python/getmtime.c
+++ b/Python/getmtime.c
@@ -1,5 +1,5 @@
 /***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
 Amsterdam, The Netherlands.
 
                         All Rights Reserved
@@ -26,8 +26,16 @@
 
 /* (A separate file because this may be OS dependent) */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef macintosh
+#include "stat.h"
+#else
 #include <sys/types.h>
 #include <sys/stat.h>
+#endif
 
 long
 getmtime(path)
diff --git a/Python/memmove.c b/Python/memmove.c
index e812751..143e642 100644
--- a/Python/memmove.c
+++ b/Python/memmove.c
@@ -1,5 +1,5 @@
 /***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
 Amsterdam, The Netherlands.
 
                         All Rights Reserved
diff --git a/Python/mystrtoul.c b/Python/mystrtoul.c
index 965421b..6b2a06f 100644
--- a/Python/mystrtoul.c
+++ b/Python/mystrtoul.c
@@ -1,5 +1,5 @@
 /***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
 Amsterdam, The Netherlands.
 
                         All Rights Reserved
@@ -22,6 +22,12 @@
 
 ******************************************************************/
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* strtol and strtoul, renamed to avoid conflicts */
+
 /*
 **	strtoul
 **		This is a general purpose routine for converting
@@ -40,7 +46,7 @@
 #include <errno.h>
 
 unsigned long
-strtoul(str, ptr, base)
+mystrtoul(str, ptr, base)
 register char *	str;
 char **		ptr;
 int		base;
@@ -108,8 +114,10 @@
 	}
 	temp = result;
 	result = result * base + c;
+#ifndef MPW
 	if ((result - c) / base != temp)	/* overflow */
 	    ovf = 1;
+#endif
 	str++;
     }
 
@@ -125,7 +133,7 @@
 }
 
 long
-strtol(str, ptr, base)
+mystrtol(str, ptr, base)
 char *	str;
 char ** ptr;
 int	base;
@@ -140,7 +148,7 @@
 	if (sign == '+' || sign == '-')
 		str++;
 	
-	result = (long) strtoul(str, ptr, base);
+	result = (long) mystrtoul(str, ptr, base);
 	
 	/* Signal overflow if the result appears negative,
 	   except for the largest negative integer */