summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.hs19
-rw-r--r--lib/Numeric/GSL/gsl-aux.c4
2 files changed, 19 insertions, 4 deletions
diff --git a/configure.hs b/configure.hs
index 7aa296e..d34cbe8 100644
--- a/configure.hs
+++ b/configure.hs
@@ -46,11 +46,17 @@ f2 = unwords . map ("-framework "++) . words
46check libs fmks = (ExitSuccess ==) `fmap` system (testprog libs fmks) 46check libs fmks = (ExitSuccess ==) `fmap` system (testprog libs fmks)
47 47
48-- simple test for GSL 48-- simple test for GSL
49testGSL = "echo \"#include <gsl/gsl_sf_gamma.h>\nint main(){gsl_sf_gamma(5);}\"" 49gsl = "echo \"#include <gsl/gsl_sf_gamma.h>\nint main(){gsl_sf_gamma(5);}\""
50 ++" > /tmp/dummy.c; gcc /tmp/dummy.c -o /tmp/dummy -lgsl -lgslcblas" 50 ++" > /tmp/dummy.c; gcc /tmp/dummy.c -o /tmp/dummy -lgsl -lgslcblas"
51 ++ " > /dev/null 2> /dev/null" 51 ++ " > /dev/null 2> /dev/null"
52 52
53checkGSL = (ExitSuccess ==) `fmap` system (testGSL) 53-- test for gsl >= 1.12
54gsl112 = "echo \"#include <gsl/gsl_sf_exp.h>\nint main(){gsl_sf_exprel_n_CF_e(1,1,0);}\""
55 ++" > /tmp/dummy.c; gcc /tmp/dummy.c -o /tmp/dummy -lgsl -lgslcblas"
56 ++ " > /dev/null 2> /dev/null"
57
58
59checkCommand c = (ExitSuccess ==) `fmap` system c
54 60
55-- test different configurations until the first one works 61-- test different configurations until the first one works
56try _ _ [] = return Nothing 62try _ _ [] = return Nothing
@@ -88,7 +94,7 @@ main = do
88 case r of 94 case r of
89 Nothing -> do 95 Nothing -> do
90 putStrLn " FAIL" 96 putStrLn " FAIL"
91 g <- checkGSL 97 g <- checkCommand gsl
92 if g 98 if g
93 then putStrLn " *** Sorry, I can't link LAPACK." 99 then putStrLn " *** Sorry, I can't link LAPACK."
94 else putStrLn " *** Sorry, I can't link GSL." 100 else putStrLn " *** Sorry, I can't link GSL."
@@ -98,4 +104,9 @@ main = do
98 writeFile "hmatrix.buildinfo" ("buildable: False\n") 104 writeFile "hmatrix.buildinfo" ("buildable: False\n")
99 Just ops -> do 105 Just ops -> do
100 putStrLn " OK" 106 putStrLn " OK"
101 writeFile "hmatrix.buildinfo" ("extra-libraries: " ++ ops++"\n") 107 g <- checkCommand gsl112
108 writeFile "hmatrix.buildinfo" $ "extra-libraries: " ++
109 ops ++ "\n" ++
110 if g
111 then ""
112 else "cc-options: -DGSL110\n"
diff --git a/lib/Numeric/GSL/gsl-aux.c b/lib/Numeric/GSL/gsl-aux.c
index 0e2116c..b811ee4 100644
--- a/lib/Numeric/GSL/gsl-aux.c
+++ b/lib/Numeric/GSL/gsl-aux.c
@@ -390,7 +390,11 @@ int minimize(int method, double f(int, double*), double tolsize, int maxit,
390 // Minimizer nmsimplex, without derivatives 390 // Minimizer nmsimplex, without derivatives
391 switch(method) { 391 switch(method) {
392 case 0 : {T = gsl_multimin_fminimizer_nmsimplex; break; } 392 case 0 : {T = gsl_multimin_fminimizer_nmsimplex; break; }
393#ifdef GSL110
394 case 1 : {T = gsl_multimin_fminimizer_nmsimplex; break; }
395#else
393 case 1 : {T = gsl_multimin_fminimizer_nmsimplex2; break; } 396 case 1 : {T = gsl_multimin_fminimizer_nmsimplex2; break; }
397#endif
394 default: ERROR(BAD_CODE); 398 default: ERROR(BAD_CODE);
395 } 399 }
396 s = gsl_multimin_fminimizer_alloc (T, my_func.n); 400 s = gsl_multimin_fminimizer_alloc (T, my_func.n);