diff options
Diffstat (limited to 'configure.hs')
-rw-r--r-- | configure.hs | 19 |
1 files changed, 15 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 | |||
46 | check libs fmks = (ExitSuccess ==) `fmap` system (testprog libs fmks) | 46 | check libs fmks = (ExitSuccess ==) `fmap` system (testprog libs fmks) |
47 | 47 | ||
48 | -- simple test for GSL | 48 | -- simple test for GSL |
49 | testGSL = "echo \"#include <gsl/gsl_sf_gamma.h>\nint main(){gsl_sf_gamma(5);}\"" | 49 | gsl = "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 | ||
53 | checkGSL = (ExitSuccess ==) `fmap` system (testGSL) | 53 | -- test for gsl >= 1.12 |
54 | gsl112 = "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 | |||
59 | checkCommand 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 |
56 | try _ _ [] = return Nothing | 62 | try _ _ [] = 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" | ||