- -- (=__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),
+ -- (=DYNAMIC not set), we search for .o libraries.
+ = do mb_libSpec <- if cUseArchivesForGhci
+ then do mb_arch_path <- findFile mk_arch_path dirs
+ case mb_arch_path of
+ Just arch_path ->
+ return (Just (Archive arch_path))
+ Nothing ->
+ return Nothing
+ else do mb_obj_path <- findFile mk_obj_path dirs
+ case mb_obj_path of
+ Just obj_path ->
+ return (Just (Object obj_path))
+ Nothing ->
+ return Nothing
+ case mb_libSpec of
+ Just ls -> return ls
+ Nothing -> return (DLL lib)
+
+ | otherwise
+ -- When the GHC package was compiled as dynamic library (=DYNAMIC set),