diff -Nurd sextractor-2.8.6.ori/acx_atlas.m4 sextractor-2.8.6/acx_atlas.m4
--- sextractor-2.8.6.ori/acx_atlas.m4	2009-01-29 11:52:02.000000000 -0200
+++ sextractor-2.8.6/acx_atlas.m4	2009-10-23 02:46:04.000000000 -0200
@@ -19,200 +19,23 @@
 dnl Search include files
 dnl --------------------
 
+
 acx_atlas_ok=no
-if test x$2 = x; then
-  if test x$1 = x; then
-    AC_CHECK_HEADERS([cblas.h clapack.h],[acx_atlas_ok=yes])
-    if test x$acx_atlas_ok = xyes; then
-      AC_DEFINE(ATLAS_BLAS_H, "cblas.h", [BLAS header filename.])
-      AC_DEFINE(ATLAS_LAPACK_H, "clapack.h", [CLAPACK header filename.])
-    else
-      AC_CHECK_HEADERS([atlas/cblas.h atlas/clapack.h],[acx_atlas_ok=yes])
-      if test x$acx_atlas_ok = xyes; then
-        AC_DEFINE(ATLAS_BLAS_H, "atlas/cblas.h", [BLAS header filename.])
-        AC_DEFINE(ATLAS_LAPACK_H, "atlas/clapack.h", [CLAPACK header filename.])
-      else
-        atlas_def=/usr/local/atlas
-        AC_CHECK_HEADERS(
-		[$atlas_def/include/cblas.h $atlas_def/include/clapack.h],
-		[acx_atlas_ok=yes])
-        if test x$acx_atlas_ok = xyes; then
-          AC_DEFINE_UNQUOTED(ATLAS_BLAS_H, "$atlas_def/include/cblas.h",
-		[BLAS header filename.])
-          AC_DEFINE_UNQUOTED(ATLAS_LAPACK_H, "$atlas_def/include/clapack.h",
-		[CLAPACK header filename.])
-        else
-          atlas_def=/usr/atlas
-          AC_CHECK_HEADERS(
-		[$atlas_def/include/cblas.h $atlas_def/include/clapack.h],
-		[acx_atlas_ok=yes])
-          if test x$acx_atlas_ok = xyes; then
-            AC_DEFINE_UNQUOTED(ATLAS_BLAS_H, "$atlas_def/include/cblas.h",
-		[BLAS header filename.])
-            AC_DEFINE_UNQUOTED(ATLAS_LAPACK_H, "$atlas_def/include/clapack.h",
-		[CLAPACK header filename.])
-          else
-            ATLAS_ERROR="CBLAS/LAPack include files not found!"
-          fi
-        fi
-      fi
-    fi
-  else
-    AC_CHECK_HEADERS([$1/include/cblas.h $1/include/clapack.h],
-		[acx_atlas_ok=yes])
-    if test x$acx_atlas_ok = xyes; then
-      AC_DEFINE_UNQUOTED(ATLAS_BLAS_H, "$1/include/cblas.h",
-		[BLAS header filename.])
-      AC_DEFINE_UNQUOTED(ATLAS_LAPACK_H, "$1/include/clapack.h",
-		[CLAPACK header filename.])
-    else
-      AC_CHECK_HEADERS([cblas.h clapack.h],[acx_atlas_ok=yes])
-      if test x$acx_atlas_ok = xyes; then
-        AC_DEFINE_UNQUOTED(ATLAS_BLAS_H, "cblas.h",
-		[BLAS header filename.])
-        AC_DEFINE_UNQUOTED(ATLAS_LAPACK_H, "clapack.h",
-		[CLAPACK header filename.])
-      else
-        ATLAS_ERROR="CBLAS/LAPack include files not found in $1/include!"
-      fi
-    fi
-  fi
+AC_CHECK_HEADERS([Accelerate/Accelerate.h],[acx_atlas_ok=yes])
+if test acx_atlas_ok = yes; then
+  AC_DEFINE(ATLAS_BLAS_H, "Accelerate/Accelerate.h", [BLAS header filename.])
+  AC_DEFINE(ATLAS_LAPACK_H, "Accelerate/Accelerate.h", [CLAPACK header filename.])
+  LIBS="$LIBS -framework vecLib"
 else
-  AC_CHECK_HEADERS([$2/cblas.h $2/clapack.h], [acx_atlas_ok=yes])
-  if test x$acx_atlas_ok = xyes; then
-    AC_DEFINE_UNQUOTED(ATLAS_BLAS_H, "$2/cblas.h",
-		[BLAS header filename.])
-    AC_DEFINE_UNQUOTED(ATLAS_LAPACK_H, "$2/clapack.h",
-		[CLAPACK header filename.])
-  else
-    ATLAS_ERROR="CBLAS/LAPack include files not found in $2!"
-  fi
-fi
-
-dnl --------------------
-dnl Search library files
-dnl --------------------
-
-if test x$acx_atlas_ok = xyes; then
-  OLIBS="$LIBS"
-  LIBS=""
-  if test x$1 = x; then
-    AC_CHECK_LIB(lapack, [clapack_dpotrf],, [acx_atlas_ok=no],
-		[-lcblas -latlas -lm])
-    AC_CHECK_LIB(cblas, cblas_dgemm,, [acx_atlas_ok=no],
-		[-latlas -lm])
-    if test x$acx_atlas_ok = xyes; then
-      ATLAS_LIBPATH=""
-    else
-      atlas_def=/usr/local/atlas
-      unset ac_cv_lib_lapack_clapack_dpotrf
-      unset ac_cv_lib_cblas_cblas_dgemm
-      acx_atlas_ok=yes
-      AC_CHECK_LIB(lapack, [clapack_dpotrf],, [acx_atlas_ok=no],
-		[-L$atlas_def/lib -lcblas -latlas -lm])
-      AC_CHECK_LIB(cblas, cblas_dgemm,, [acx_atlas_ok=no],
-		[-L$atlas_def/lib -latlas -lm])
-      if test x$acx_atlas_ok = xyes; then
-        ATLAS_LIBPATH="-L$atlas_def/lib"
-      else
-        atlas_def=/usr/lib64/atlas
-        unset ac_cv_lib_lapack_clapack_dpotrf
-        unset ac_cv_lib_cblas_cblas_dgemm
-        acx_atlas_ok=yes
-        AC_CHECK_LIB(lapack, [clapack_dpotrf],, [acx_atlas_ok=no],
-		[-L$atlas_def -lcblas -latlas -lm])
-        AC_CHECK_LIB(cblas, cblas_dgemm,, [acx_atlas_ok=no],
-		[-L$atlas_def -latlas -lm])
-        if test x$acx_atlas_ok = xyes; then
-          ATLAS_LIBPATH="-L$atlas_def"
-        else
-          atlas_def=/usr/lib/atlas
-          unset ac_cv_lib_lapack_clapack_dpotrf
-          unset ac_cv_lib_cblas_cblas_dgemm
-          acx_atlas_ok=yes
-          AC_CHECK_LIB(lapack, [clapack_dpotrf],, [acx_atlas_ok=no],
-		[-L$atlas_def -lcblas -latlas -lm])
-          AC_CHECK_LIB(cblas, cblas_dgemm,, [acx_atlas_ok=no],
-		[-L$atlas_def -latlas -lm])
-          if test x$acx_atlas_ok = xyes; then
-            ATLAS_LIBPATH="-L$atlas_def"
-          else
-            atlas_def=/usr/atlas
-            unset ac_cv_lib_lapack_clapack_dpotrf
-            unset ac_cv_lib_cblas_cblas_dgemm
-            acx_atlas_ok=yes
-            AC_CHECK_LIB(lapack, [clapack_dpotrf],, [acx_atlas_ok=no],
-		[-L$atlas_def/lib -lcblas -latlas -lm])
-            AC_CHECK_LIB(cblas, cblas_dgemm,, [acx_atlas_ok=no],
-		[-L$atlas_def/lib -latlas -lm])
-            if test x$acx_atlas_ok = xyes; then
-              ATLAS_LIBPATH="-L$atlas_def/lib"
-            else
-              ATLAS_ERROR="CBLAS/LAPack library files not found at usual locations!"
-            fi
-          fi
-        fi
-      fi
-    fi
-  else
-    AC_CHECK_LIB(lapack, [clapack_dpotrf],, [acx_atlas_ok=no],
-		[-L$1 -lcblas -latlas -lm])
-    AC_CHECK_LIB(cblas, cblas_dgemm,, [acx_atlas_ok=no],
-		[-L$1 -latlas -lm])
-    if test x$acx_atlas_ok = xyes; then
-      ATLAS_LIBPATH="-L$1"
-    else
-      unset ac_cv_lib_lapack_clapack_dpotrf
-      unset ac_cv_lib_cblas_cblas_dgemm
-      acx_atlas_ok=yes
-      AC_CHECK_LIB(lapack, [clapack_dpotrf],, [acx_atlas_ok=no],
-		[-L$1/lib -lcblas -latlas -lm])
-      AC_CHECK_LIB(cblas, cblas_dgemm,, [acx_atlas_ok=no],
-		[-L$1/lib -latlas -lm])
-      if test x$acx_atlas_ok = xyes; then
-        ATLAS_LIBPATH="-L$1/lib"
-      else
-        ATLAS_ERROR="CBLAS/LAPack library files not found in $1!"
-      fi
-    fi
-  fi
-  LIBS="$OLIBS"
+  ATLAS_ERROR="Accelerate/Accelerate.h not found!"
+  AC_SUBST(ATLAS_ERROR)
 fi
 
 AC_SUBST(ATLAS_LIBPATH)
 AC_SUBST(ATLAS_CFLAGS)
-
-dnl -------------------------------------------------------------------------
-dnl Finally, check MP version and execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND
-dnl -------------------------------------------------------------------------
-if test x"$acx_atlas_ok" = xyes; then
-  AC_DEFINE(HAVE_ATLAS,1,
-	[Define if you have the ATLAS libraries and header files.])
-  if test x$3 = xyes; then
-dnl Check whether the multithreaded version of ATLAS is there too:
-    AC_CHECK_LIB(ptcblas, cblas_dgemm,, [acx_atlas_ok=no],
-	[$ATLAS_LIBPATH -lcblas -latlas -lm])
-    if test x$acx_atlas_ok = xyes; then
-      ATLAS_LIB="$ATLAS_LIBPATH -llapack -lptcblas -lcblas -latlas"
-      LIBS="$OLIBS"
-      AC_SUBST(ATLAS_LIB)
-      AC_DEFINE(HAVE_ATLAS_MP,1,
-	[Define if you have the parallel ATLAS libraries.])
-      $4
-    else
-      ATLAS_ERROR="CBLAS/LAPack was compiled without multithreading support!"
-      AC_SUBST(ATLAS_ERROR)
-      $5         
-    fi
-  else
-    ATLAS_LIB="$ATLAS_LIBPATH -llapack -lcblas -latlas"
-    LIBS="$OLIBS"
-    AC_SUBST(ATLAS_LIB)
-    $4
-  fi
-else
-  AC_SUBST(ATLAS_ERROR)
-  $5
-fi
+ATLAS_LIB="-framework vecLib"
+AC_SUBST(ATLAS_LIB)
+AC_DEFINE(HAVE_ATLAS_MP,1,[Define if you have the parallel ATLAS libraries.])
+$4
 
 ])dnl ACX_ATLAS
diff -Nurd sextractor-2.8.6.ori/acx_fftw.m4 sextractor-2.8.6/acx_fftw.m4
--- sextractor-2.8.6.ori/acx_fftw.m4	2009-01-29 11:52:02.000000000 -0200
+++ sextractor-2.8.6/acx_fftw.m4	2009-10-21 17:22:59.000000000 -0200
@@ -49,7 +49,7 @@
 else
   AC_CHECK_HEADER($2/fftw3.h,[acx_fftw_ok=yes])
   if test x$acx_fftw_ok = xyes; then
-    AC_DEFINE(FFTW_H, "$2/fftw3.h", [FFTW header filename.])
+    AC_DEFINE_UNQUOTED(FFTW_H, "$2/fftw3.h", [FFTW header filename.])
   else
     FFTW_ERROR="FFTW include files not found in $2!"
   fi
diff -Nurd sextractor-2.8.6.ori/src/fft.c sextractor-2.8.6/src/fft.c
--- sextractor-2.8.6.ori/src/fft.c	2009-01-29 11:52:00.000000000 -0200
+++ sextractor-2.8.6/src/fft.c	2009-10-23 02:50:02.000000000 -0200
@@ -22,7 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <fftw3.h>
+#include FFTW_H
 
 #include "define.h"
 #include "globals.h"
diff -Nurd sextractor-2.8.6.ori/src/levmar/lm.h sextractor-2.8.6/src/levmar/lm.h
--- sextractor-2.8.6.ori/src/levmar/lm.h	2009-01-29 11:51:58.000000000 -0200
+++ sextractor-2.8.6/src/levmar/lm.h	2009-10-23 01:36:57.000000000 -0200
@@ -27,7 +27,6 @@
 
 /* specify whether to use LAPACK or not. The first option is strongly recommended */
 #define HAVE_LAPACK /* use LAPACK */
-#undef HAVE_LAPACK  /* uncomment this to force not using LAPACK */
 
 /* to avoid the overhead of repeated mallocs(), routines in Axb.c can be instructed to
  * retain working memory between calls. Such a choice, however, renders these routines
@@ -42,7 +41,6 @@
  * both the single and double precision routines
  */
 #define LM_DBL_PREC  /* comment this if you don't want the double precision routines to be compiled */
-#define LM_SNGL_PREC /* comment this if you don't want the single precision routines to be compiled */
 
 /****************** End of configuration options, no changes necessary beyond this point ******************/
 
diff -Nurd sextractor-2.8.6.ori/src/pattern.c sextractor-2.8.6/src/pattern.c
--- sextractor-2.8.6.ori/src/pattern.c	2009-03-18 07:59:57.000000000 -0300
+++ sextractor-2.8.6/src/pattern.c	2009-10-23 03:02:10.000000000 -0200
@@ -28,7 +28,8 @@
 #include	<stdio.h>
 #include	<stdlib.h>
 #include	<string.h>
-#include	ATLAS_LAPACK_H
+
+#include <Accelerate/Accelerate.h>
 
 #include	"define.h"
 #include	"globals.h"
@@ -132,6 +133,107 @@
   return;
   }
 
+/* The Accelerate framework hasn't got clapack_dpotrf or clapack_dpotrs, so we borrow these functions from ATLAS. A bit of licence information, first */
+
+/*
+ *             Automatically Tuned Linear Algebra Software v3.6.0
+ *                    (C) Copyright 1999 R. Clint Whaley
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions, and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *   3. The name of the ATLAS group or the names of its contributers may
+ *      not be used to endorse or promote products derived from this
+ *      software without specific written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ATLAS GROUP OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+int clapack_dpotrf(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
+		const int N, double *A, const int LDA)
+{
+	char uplo = 'U';
+	int info = 0;
+	if (Order==CblasRowMajor)
+	{//A is symmetric, we switch Uplo to get result for CblasRowMajor
+		if (Uplo==CblasUpper)
+			uplo='L';
+	}
+	else
+		if (Uplo==CblasLower)
+			uplo='L';
+	dpotrf(uplo, N, A, LDA, &info);
+	int n=N;
+	int lda=LDA;
+	dpotrf(&uplo, &n, A, &lda, &info);
+	return info;
+}
+
+int clapack_dpotrs(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
+		const int N, const int NRHS, const double *A, const int lda,
+		double *B, const int ldb)
+{
+	int ierr=0;
+	if (Order != CblasRowMajor && Order != CblasColMajor)
+	{
+		ierr = -1;
+		cblas_xerbla(1, "clapack_dpotrs",
+				"Order must be %d or %d, but is set to %d\n",
+				CblasRowMajor, CblasColMajor, Order);
+	}
+	if (Uplo != CblasUpper && Uplo != CblasLower)
+	{
+		ierr = -2;
+		cblas_xerbla(2, "clapack_dpotrs",
+				"Uplo must be %d or %d, but is set to %d\n",
+				CblasUpper, CblasLower, Uplo);
+	}
+	if (N < 0)
+	{
+		ierr = -3;
+		cblas_xerbla(3, "clapack_dpotrs",
+				"N cannot be less than zero 0,; is set to %d.\n", N);
+	}
+	if (NRHS < 0)
+	{
+		ierr = -4;
+		cblas_xerbla(4, "clapack_dgetrs",
+				"NRHS cannot be less than zero 0,; is set to %d.\n", NRHS);
+	}
+	if (lda < N || lda < 1)
+	{
+		ierr = -6;
+		cblas_xerbla(6, "clapack_dpotrs",
+				"lda must be >= MAX(N,1): lda=%d N=%d\n", lda, N);
+	}
+	if (ldb < N || ldb < 1)
+	{
+		ierr = -8;
+		cblas_xerbla(8, "clapack_dpotrs",
+				"ldb must be >= MAX(N,1): ldb=%d N=%d\n", ldb, N);
+	}
+	if (!ierr) dpotrs(Order, Uplo, N, NRHS, A, lda, B, ldb);
+	return(ierr);
+}
+
+/* End of functions borrowed from ATLAS. Thanks! */
+
 
 /****** pattern_fit ******************************************************
 PROTO	void pattern_resample(patternstruct *pattern)
