- | not picIsOn
- -- When the GHC package was not compiled as dynamic library
- -- (=__PIC__ not set), we search for .o libraries first.
- = do { mb_obj_path <- findFile mk_obj_path dirs
- ; case mb_obj_path of
- Just obj_path -> return (Object obj_path)
- Nothing ->
- do { mb_lib_path <- findFile mk_dyn_lib_path dirs
- ; case mb_lib_path of
- Just _ -> return (DLL dyn_lib_name)
- Nothing -> return (DLL lib) }} -- We assume
- | otherwise
- -- When the GHC package was compiled as dynamic library (=__PIC__ set),
+ | not ("HS" `isPrefixOf` lib)
+ -- For non-Haskell libraries (e.g. gmp, iconv) we assume dynamic library
+ = assumeDll
+ | not isDynamicGhcLib
+ -- When the GHC package was not compiled as dynamic library
+ -- (=DYNAMIC not set), we search for .o libraries or, if they
+ -- don't exist, .a libraries.
+ = findObject `orElse` findArchive `orElse` assumeDll
+ | otherwise
+ -- When the GHC package was compiled as dynamic library (=DYNAMIC set),