Author: Ole Streicher <debian@liska.ath.cx>
Description: Replace clapack by lapack.
 Gnu Fortran uses the same calling interface as F2c. Therefore, just the C prototypes
 are needed. The only recipe using lapack is xsh_subtract_sky_single.
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -7,7 +7,7 @@
     AC_MSG_CHECKING([for lapack])
 
     xsh_lapack_check_header="clapack.h"
-    xsh_lapack_check_lib="libclapack.a"
+    xsh_lapack_check_lib="liblapack.so"
 
     xsh_lapack_includes=""
     xsh_lapack_libraries=""
@@ -53,8 +53,7 @@
             xsh_lapack_incdirs="$xsh_with_lapack_includes"
         fi
 
-        ESO_FIND_FILE($xsh_lapack_check_header, $xsh_lapack_incdirs,
-                      xsh_lapack_includes)
+	xsh_lapack_includes=notneeded
 
 
         # Check for the lapack library
@@ -100,7 +99,7 @@
         LAPACK_LDFLAGS="-L$xsh_lapack_libraries"
         LDFLAGS="$LDFLAGS $LAPACK_LDFLAGS"
         CPPFLAGS="$CPPFLAGS $LAPACK_INCLUDES"
-        AC_CHECK_LIB([clapack], [main], [LIBLAPACKC="-lclapack"], AC_MSG_ERROR([Library clapack not found]))
+        AC_CHECK_LIB([lapack], [main], [LIBLAPACKC="-llapack"], AC_MSG_ERROR([Library lapacke not found]))
         LIBS="$LIBS $LIBLAPACKC"
         LIBLAPACK="$LIBLAPACKC"
     else
--- a/xsh/xsh_subtract_sky_single.c
+++ b/xsh/xsh_subtract_sky_single.c
@@ -71,14 +71,11 @@
          * implements its own version of this type, which otherwise breaks
          * complation. We do not however use the complex type in this source
          * file so this workaround should be harmless. */
-        #ifdef complex
-                #undef complex
-        #endif
-        #define complex f2c_complex
-
-	#include <f2c.h>
-	#include <clapack.h>
-#endif 
+
+void spbtrf_(char *, int *, int *, float *, int *, int *);
+void spbtrs_(char *, int *, int *, int *, const float *,
+	     int *, float *,int *, int *);
+#endif
 
 #define REGDEBUG_MEDIAN_SPLINE 0
 /*-----------------------------------------------------------------------------
@@ -268,12 +265,12 @@
       __CLPK_integer ldb=ncoeffs;
       __CLPK_integer info=0;
 #else
-      integer clpk_n=ncoeffs;
-      integer kd=ord_minus_1;
-      integer nrhs=1;
-      integer ldab=ord;
-      integer ldb=ncoeffs;
-      integer info=0;
+      int clpk_n=ncoeffs;
+      int kd=ord_minus_1;
+      int nrhs=1;
+      int ldab=ord;
+      int ldb=ncoeffs;
+      int info=0;
 #endif
 
       /* Fill the basis function (Bn) and flux (y) matrices for the fitted lambda, 
@@ -361,8 +358,8 @@
       }
 		
       /* Do the fit, by Cholesky decomposition, using Lapack functions sptrf and spdtrs */
-      err=spbtrf_(&uplo,&clpk_n,&kd,Xtp,&ldab,&info);
-      err=spbtrs_(&uplo,&clpk_n,&kd,&nrhs,Xtp,&ldab,c,&ldb,&info);
+      spbtrf_(&uplo,&clpk_n,&kd,Xtp,&ldab,&info);
+      spbtrs_(&uplo,&clpk_n,&kd,&nrhs,Xtp,&ldab,c,&ldb,&info);
 		
       /* Fill y with the predicted flux from the fit, over all values (using Bn_full) */
 		
