Blob Blame History Raw
diff -urp mathgl-2.3.3/CMakeLists.txt mathgl-2.3.3-gsl2/CMakeLists.txt
--- mathgl-2.3.3/CMakeLists.txt	2015-06-01 13:29:26.000000000 +0600
+++ mathgl-2.3.3-gsl2/CMakeLists.txt	2015-11-24 12:10:43.580786919 +0600
@@ -259,6 +259,13 @@ endif(enable-pthread)
 
 if(enable-gsl)
 	set(MGL_HAVE_GSL 1)
+	FIND_PACKAGE(PkgConfig)
+	pkg_check_modules(GSL2 REQUIRED gsl)
+	if ( GSL2_FOUND )
+		if ( NOT ${GSL2_VERSION} LESS 2.0 )
+			SET(ISGSL2 1)
+		endif ( NOT ${GSL_VERSION} LESS 2.0 )
+	endif ( GSL2_FOUND )
 	find_library(GSL_LIB gsl)
 	find_library(GSL_CBLAS_LIB gslcblas)
 	find_path(GSL_INCLUDE_DIR gsl/gsl_fft_complex.h)
diff -urp mathgl-2.3.3/src/CMakeLists.txt mathgl-2.3.3-gsl2/src/CMakeLists.txt
--- mathgl-2.3.3/src/CMakeLists.txt	2015-06-01 13:29:02.000000000 +0600
+++ mathgl-2.3.3-gsl2/src/CMakeLists.txt	2015-11-24 12:11:14.494707480 +0600
@@ -23,6 +23,9 @@ ${MathGL_BINARY_DIR}/include/mgl2/dllexp
 )
 
 add_definitions(-DMGL_SRC)
+if(DEFINED ISGSL2)
+add_definitions(-DHAVE_GSL_2)
+endif(DEFINED ISGSL2)
 
 if(MGL_HAVE_PNG)
 	set(prc_src prc/PRCbitStream.cc prc/PRCdouble.cc prc/oPRCFile.cc prc/writePRC.cc prc.cpp )
diff -urp mathgl-2.3.3/src/fit.cpp mathgl-2.3.3-gsl2/src/fit.cpp
--- mathgl-2.3.3/src/fit.cpp	2015-06-01 13:29:02.000000000 +0600
+++ mathgl-2.3.3-gsl2/src/fit.cpp	2015-11-24 12:13:39.912670946 +0600
@@ -193,7 +193,14 @@ mreal MGL_NO_EXPORT mgl_fit_base(mglFitD
 	}
 	while ( status == GSL_CONTINUE && iter < 500 );
 	gsl_matrix *covar = gsl_matrix_alloc(m, m);
+#ifdef HAVE_GSL_2
+	gsl_matrix *J = gsl_matrix_alloc(s->fdf->n, s->fdf->p);
+	gsl_multifit_fdfsolver_jac(s, J);
+	gsl_multifit_covar (J, 0.0, covar);
+	gsl_matrix_free (J);
+#else
 	gsl_multifit_covar (s->J, 0.0, covar );
+#endif
 	mglFitCovar.Set(covar);
 	mreal res = gsl_blas_dnrm2(s->f);
 	for(i=0;i<m;i++)	ini[i] = gsl_vector_get(s->x, i);