diff --git a/config/root-config.in b/config/root-config.in
index d1bf5db59cb90989bdc75fb170d144384afd34cc..6994d4f7e9cbe51ca34bfc9c32d568512b90eb5a 100755
--- a/config/root-config.in
+++ b/config/root-config.in
@@ -422,6 +422,19 @@ freebsd*|linux*)
       fi
    done
    ;;
+macosx*)
+   for f in $features ; do
+      if test "x$f" = "xthread" ; then
+         if [ $macosx_minor -ge 5 ]; then
+            auxcflags="-D_REENTRANT -pthread $auxcflags"
+            auxlibs="-pthread $auxlibs"
+         else
+	    auxcflags="-D_REENTRANT $auxcflags"
+	    auxlibs="-lpthread $auxlibs"
+         fi
+      fi
+   done
+   ;;
 hpuxacc | hpuxia64acc)
    for f in $features ; do
       if test "x$f" = "xthread" ; then
diff --git a/configure b/configure
index cb0bac630de22d89e0da1c045a346c8f626df82d..1115162c513494953f9d11e3427a0ad16ae08d3b 100755
--- a/configure
+++ b/configure
@@ -731,7 +731,7 @@ guess_architecture () {
             ;;
     esac
     if [ "$arch" = "macosx" ]; then
-       if [ `sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2` = 5 ]; then
+       if [ `sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2` -ge 5 ]; then
           if `sysctl machdep.cpu.extfeatures | grep "64" > /dev/null  2>&1` ; then
              arch=macosx64
           fi
@@ -1391,11 +1391,24 @@ fi
 # Check for posix thread library
 #
 case $platform in
-macosx|win32)
+win32)
     if test "x$enable_thread" = "x"; then
         enable_thread="yes"
     fi
     ;;
+macosx)
+    if test "x$enable_thread" = "x" || test "x$enable_thread" = "xyes"; then
+        if [ `sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2` -ge 5 ]; then
+            enable_thread="yes"
+            threadflag="-D_REENTRANT -pthread"
+            threadlib="-pthread"
+            threadlibdir=
+        else
+            enable_thread="yes"
+            threadflag="-D_REENTRANT"
+        fi
+    fi
+    ;;
 linux|fbsd)
     if test "x$enable_thread" = "x" || test "x$enable_thread" = "xyes"; then
         enable_thread="yes"
@@ -1414,7 +1427,7 @@ win32gcc)
     fi
     ;;
 hpuxia64acc)
-    if test "x$enable_thread" = "x"; then
+    if test "x$enable_thread" = "x" || test "x$enable_thread" = "xyes"; then
         enable_thread="yes"
         threadflag="-mt"
         threadlib="-mt"
@@ -1615,7 +1628,7 @@ if test ! "x$enable_opengl" = "xno" && test ! "$platform" = "win32" ; then
 
     # Mac OS X 10.5.0 problem
     if test "x$platform" = "xmacosx"; then
-       if [ `sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2` = 5 ]; then
+       if [ `sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2` -eq 5 ]; then
           opengllib="-dylib_file /usr/X11R6/lib/libGL.dylib:/usr/X11R6/lib/libGL.dylib"
        fi
     fi