--- configure.in.orig	2005-07-28 12:46:05.000000000 -0500
+++ configure.in	2005-07-28 12:46:14.000000000 -0500
@@ -159,7 +159,7 @@
   # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently,
   # this is fixed in 10.3, which identifies itself as Darwin/7.*
   # This should hopefully be fixed in FreeBSD 4.9
-  FreeBSD/4.8* | Darwin/6* )
+  FreeBSD/4.8* | Darwin/6* | Darwin/8*)
     define_xopen_source=no;;
   # On AIX 4, mbstate_t is defined only when _XOPEN_SOURCE == 500 but used in
   # wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined or
@@ -554,6 +554,13 @@
 	  BLDLIBRARY='-L. -lpython$(VERSION)'
 	  RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
 	  ;;
+    Darwin*)
+	  if test -z "$enable_framework"; then
+	    LDLIBRARY='libpython$(VERSION).dylib'
+	    BLDLIBRARY='-L. -lpython$(VERSION)'
+	    RUNSHARED=DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}
+	  fi
+	  ;;
   esac
   # DG/UX requires some fancy ld contortions to produce a .so from an .a
   case $MACHDEP in
@@ -687,7 +694,12 @@
 	    ;;
 	# is there any other compiler on Darwin besides gcc?
 	Darwin*)
-	    BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+		if [[ `/usr/bin/arch` = 'ppc' ]]
+		then
+			BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common"
+		else
+			BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -fno-common"
+		fi
 	    ;;
     esac
     ;;
@@ -1293,8 +1305,8 @@
 			LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
 		else
 			# No framework, use the Python app as bundle-loader
-			BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
-			LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+			BLDSHARED="$LDSHARED "'-flat_namespace -undefined suppress -bundle_loader $(BUILDPYTHON)'
+			LDSHARED="$LDSHARED "'-flat_namespace -undefined suppress -bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
 		fi ;;
 	Darwin/*)
 		# Use -undefined dynamic_lookup whenever possible (10.3 and later).
@@ -1740,7 +1752,7 @@
   SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
                        Defined for Solaris 2.6 bug in pthread header.)
 		       ;;
-      SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
+      SunOS/5.8 | Darwin/8*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
 		       Define if the Posix semaphores do not work on your system)
 		       ;;
       esac
@@ -2274,13 +2286,23 @@
    [Define if getpgrp() must be called as getpgrp(0).])
  )
 )
-AC_CHECK_FUNCS(setpgrp,
-  AC_TRY_COMPILE([#include <unistd.h>],
-    [setpgrp(0,0);],
+
+case $ac_sys_system/$ac_sys_release in
+Darwin/8*)
     AC_DEFINE(SETPGRP_HAVE_ARG, 1,
     [Define if setpgrp() must be called as setpgrp(0, 0).])
-  )
-)
+    ;;
+*)
+    AC_CHECK_FUNCS(setpgrp,
+      AC_TRY_COMPILE([#include <unistd.h>],
+        [setpgrp(0,0);],
+        AC_DEFINE(SETPGRP_HAVE_ARG, 1,
+        [Define if setpgrp() must be called as setpgrp(0, 0).])
+      )
+    )
+    ;;
+esac
+
 AC_CHECK_FUNCS(gettimeofday, 
   AC_TRY_COMPILE([#include <sys/time.h>], 
     [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
