summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.hs15
1 files changed, 13 insertions, 2 deletions
diff --git a/configure.hs b/configure.hs
index 3b0aaa3..2764dbc 100644
--- a/configure.hs
+++ b/configure.hs
@@ -36,7 +36,8 @@ opts = [ "" -- Ubuntu/Debian
36 ] 36 ]
37 37
38-- compile a simple program with symbols from GSL and LAPACK with the given libs 38-- compile a simple program with symbols from GSL and LAPACK with the given libs
39testprog libs fmks = "echo \"int main(){zgesvd_(); gsl_sf_gamma();}\" > /tmp/dummy.c; gcc /tmp/dummy.c " 39testprog libs fmks = "echo \"#include <gsl/gsl_math.h>\nint main(){zgesvd_(); gsl_sf_gamma();}\""
40 ++" > /tmp/dummy.c; gcc /tmp/dummy.c -o /tmp/dummy "
40 ++ f1 libs ++ " " ++ f2 fmks ++ " > /dev/null 2> /dev/null" 41 ++ f1 libs ++ " " ++ f2 fmks ++ " > /dev/null 2> /dev/null"
41 42
42f1 = unwords . map ("-l"++) . words 43f1 = unwords . map ("-l"++) . words
@@ -44,6 +45,13 @@ f2 = unwords . map ("-framework "++) . words
44 45
45check libs fmks = (ExitSuccess ==) `fmap` system (testprog libs fmks) 46check libs fmks = (ExitSuccess ==) `fmap` system (testprog libs fmks)
46 47
48-- simple test for GSL
49testGSL = "echo \"#include <gsl/gsl_math.h>\nint main(){gsl_sf_gamma();}\""
50 ++" > /tmp/dummy.c; gcc /tmp/dummy.c -o /tmp/dummy -lgsl -lgslcblas"
51 ++ " > /dev/null 2> /dev/null"
52
53checkGSL = (ExitSuccess ==) `fmap` system (testGSL)
54
47-- test different configurations until the first one works 55-- test different configurations until the first one works
48try _ _ [] = return Nothing 56try _ _ [] = return Nothing
49try b f (opt:rest) = do 57try b f (opt:rest) = do
@@ -80,7 +88,10 @@ main = do
80 case r of 88 case r of
81 Nothing -> do 89 Nothing -> do
82 putStrLn " FAIL" 90 putStrLn " FAIL"
83 putStrLn " *** Sorry, I can't link gsl and lapack." 91 g <- checkGSL
92 if g
93 then putStrLn " *** Sorry, I can't link LAPACK."
94 else putStrLn " *** Sorry, I can't link GSL."
84 putStrLn " *** Please make sure that the appropriate -dev packages are installed." 95 putStrLn " *** Please make sure that the appropriate -dev packages are installed."
85 putStrLn " *** You can also specify the required libraries using" 96 putStrLn " *** You can also specify the required libraries using"
86 putStrLn " *** cabal install hmatrix --configure-option=link:lib1,lib2,lib3,etc." 97 putStrLn " *** cabal install hmatrix --configure-option=link:lib1,lib2,lib3,etc."