Patch #488073: AtheOS port.
diff --git a/configure b/configure
index b08af5d..92bf5f6 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.321 .
+# From configure.in Revision: 1.322 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.53.
 #
@@ -1293,6 +1293,7 @@
 	case $MACHDEP in
 	cygwin*) MACHDEP="cygwin";;
 	darwin*) MACHDEP="darwin";;
+	atheos*) MACHDEP="atheos";;
 	'')	MACHDEP="unknown";;
 	esac
 fi
@@ -3072,7 +3073,7 @@
 if test -z "$enable_shared"
 then
   case $ac_sys_system in
-  CYGWIN*)
+  CYGWIN* | atheos*)
     enable_shared="yes";;
   *)
     enable_shared="no";;
@@ -3131,6 +3132,11 @@
          BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
 	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
 	  ;;
+    atheos*)
+	  LDLIBRARY='libpython$(VERSION).so'
+	  BLDLIBRARY='-L. -lpython$(VERSION)'
+	  RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
+	  ;;
   esac
   # DG/UX requires some fancy ld contortions to produce a .so from an .a
   case $MACHDEP in
@@ -3384,6 +3390,7 @@
 	case $ac_sys_system in
 		BeOS*) LN="ln -s";;
 		CYGWIN*) LN="ln -s";;
+		atheos*) LN="ln -s";;
 		*) LN=ln;;
 	esac
 fi
@@ -8779,6 +8786,7 @@
 	SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
 	Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
 	CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
+	atheos*) LDSHARED="gcc -shared";;
 	*)	LDSHARED="ld";;
 	esac
 fi
@@ -8814,6 +8822,7 @@
 		   *) CCSHARED="";;
 		   esac;;
 	CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
+	atheos*) CCSHARED="-fPIC";;
 	esac
 fi
 echo "$as_me:$LINENO: result: $CCSHARED" >&5
@@ -8883,6 +8892,23 @@
 echo "$as_me:$LINENO: result: $CFLAGSFORSHARED" >&5
 echo "${ECHO_T}$CFLAGSFORSHARED" >&6
 
+# SHLIBS are libraries (except -lc and -lm) to link to the python shared
+# library (with --enable-shared).
+# For platforms on which shared libraries are not allowed to have unresolved
+# symbols, this must be set to $(LIBS) (expanded by make).
+
+echo "$as_me:$LINENO: checking SHLIBS" >&5
+echo $ECHO_N "checking SHLIBS... $ECHO_C" >&6
+case "$ac_sys_system" in
+	atheos*)
+		SHLIBS='$(LIBS)';;
+	*)
+		SHLIBS='';;
+esac
+echo "$as_me:$LINENO: result: $SHLIBS" >&5
+echo "${ECHO_T}$SHLIBS" >&6
+
+
 # checks for libraries
 
 echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
@@ -9870,6 +9896,120 @@
     THREADOBJ="Python/thread.o"
 else
 
+    if test "${ac_cv_header_atheos_threads_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for atheos/threads.h" >&5
+echo $ECHO_N "checking for atheos/threads.h... $ECHO_C" >&6
+if test "${ac_cv_header_atheos_threads_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_atheos_threads_h" >&5
+echo "${ECHO_T}$ac_cv_header_atheos_threads_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking atheos/threads.h usability" >&5
+echo $ECHO_N "checking atheos/threads.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <atheos/threads.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f 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 atheos/threads.h presence" >&5
+echo $ECHO_N "checking atheos/threads.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <atheos/threads.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -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; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+  cat 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 in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: atheos/threads.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: atheos/threads.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: atheos/threads.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: atheos/threads.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: atheos/threads.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: atheos/threads.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for atheos/threads.h" >&5
+echo $ECHO_N "checking for atheos/threads.h... $ECHO_C" >&6
+if test "${ac_cv_header_atheos_threads_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_atheos_threads_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_atheos_threads_h" >&5
+echo "${ECHO_T}$ac_cv_header_atheos_threads_h" >&6
+
+fi
+if test $ac_cv_header_atheos_threads_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define WITH_THREAD 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define ATHEOS_THREADS 1
+_ACEOF
+
+    THREADOBJ="Python/thread.o"
+else
+
     if test "${ac_cv_header_kernel_OS_h+set}" = set; then
   echo "$as_me:$LINENO: checking for kernel/OS.h" >&5
 echo $ECHO_N "checking for kernel/OS.h... $ECHO_C" >&6
@@ -10326,6 +10466,9 @@
 
 fi
 
+
+fi
+
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi;
@@ -11192,6 +11335,7 @@
 	BeOS*) DYNLOADFILE="dynload_beos.o";;
 	hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
 	Darwin/*) 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
@@ -16394,6 +16538,7 @@
 s,@CCSHARED@,$CCSHARED,;t t
 s,@LINKFORSHARED@,$LINKFORSHARED,;t t
 s,@CFLAGSFORSHARED@,$CFLAGSFORSHARED,;t t
+s,@SHLIBS@,$SHLIBS,;t t
 s,@USE_SIGNAL_MODULE@,$USE_SIGNAL_MODULE,;t t
 s,@SIGNAL_OBJS@,$SIGNAL_OBJS,;t t
 s,@USE_THREAD_MODULE@,$USE_THREAD_MODULE,;t t