diff options
Diffstat (limited to 'Config.hs')
-rw-r--r-- | Config.hs | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -79,6 +79,18 @@ gsl112 bInfo buildInfo = | |||
79 | ++ (join $ map ("-L"++) $ extraLibDirs buildInfo) ++ " -lgsl -lgslcblas" | 79 | ++ (join $ map ("-L"++) $ extraLibDirs buildInfo) ++ " -lgsl -lgslcblas" |
80 | ++ " > /dev/null 2> /dev/null" | 80 | ++ " > /dev/null 2> /dev/null" |
81 | 81 | ||
82 | -- test for odeiv2 | ||
83 | gslodeiv2 bInfo buildInfo = | ||
84 | "echo \"#include <gsl/gsl_odeiv2.h>\nint main(){return 0;}\"" | ||
85 | ++" > " ++ (buildDir bInfo) ++ "/dummy.c; gcc " | ||
86 | ++ (buildDir bInfo) ++ "/dummy.c " | ||
87 | ++ (join $ ccOptions buildInfo) ++ " " | ||
88 | ++ (join $ cppOptions buildInfo) ++ " " | ||
89 | ++ (join $ map ("-I"++) $ includeDirs buildInfo) | ||
90 | ++" -o " ++ (buildDir bInfo) ++ "/dummy " | ||
91 | ++ (join $ map ("-L"++) $ extraLibDirs buildInfo) ++ " -lgsl -lgslcblas" | ||
92 | ++ " > /dev/null 2> /dev/null" | ||
93 | |||
82 | 94 | ||
83 | checkCommand c = (ExitSuccess ==) `fmap` system c | 95 | checkCommand c = (ExitSuccess ==) `fmap` system c |
84 | 96 | ||
@@ -133,9 +145,11 @@ config bInfo = do | |||
133 | return (Just emptyBuildInfo { buildable = False }, []) | 145 | return (Just emptyBuildInfo { buildable = False }, []) |
134 | Just ops -> do | 146 | Just ops -> do |
135 | putStrLn $ " OK " ++ ops | 147 | putStrLn $ " OK " ++ ops |
136 | g <- checkCommand $ gsl112 bInfo buildInfo | 148 | g1 <- checkCommand $ gsl112 bInfo buildInfo |
137 | let hbi = if g | 149 | let op1 = if g1 then "" else "-DGSL110" |
138 | then emptyBuildInfo { extraLibs = words ops} | 150 | g2 <- checkCommand $ gslodeiv2 bInfo buildInfo |
139 | else emptyBuildInfo { extraLibs = words ops, ccOptions = ["-DGSL110"]} | 151 | let op2 = if g2 then "" else "-DGSLODE1" |
152 | opts = filter (not.null) [op1,op2] | ||
153 | let hbi = emptyBuildInfo { extraLibs = words ops, ccOptions = opts } | ||
140 | return (Just hbi, []) | 154 | return (Just hbi, []) |
141 | 155 | ||