compileFFI :: Verbosity -> BuildInfo -> LocalBuildInfo -> FilePath -> FilePath -> IO ()
compileFFI verbosity bi lbi modDir file = do
    (_, opts, file_incs) <- getOptionsFromSource file
    let ghcOpts = [ op | (GHC, ops) <- opts, op <- ops ]
    let pkg_incs = ["\"" ++ inc ++ "\"" | inc <- includes bi]
    let incs = nub (sort (file_incs ++ includeOpts ghcOpts ++ pkg_incs))
    let pathFlag = "-P" ++ modDir ++ [searchPathSeparator]
    let hugsArgs = "-98" : pathFlag : map ("-i" ++) incs
    cfiles <- getCFiles file
    let cArgs =
            ["-I" ++ dir | dir <- includeDirs bi] ++
            ccOptions bi ++
            cfiles ++
            ["-L" ++ dir | dir <- extraLibDirs bi] ++
            ldOptions bi ++
            ["-l" ++ lib | lib <- extraLibs bi] ++
            concat [["-framework", f] | f <- frameworks bi]
    rawSystemProgramConf verbosity ffihugsProgram (withPrograms lbi)
      (hugsArgs ++ file : cArgs)
compileFFI :: Verbosity -> BuildInfo -> LocalBuildInfo -> FilePath -> FilePath -> IO ()
compileFFI verbosity bi lbi modDir file = do
    (_, opts, file_incs) <- getOptionsFromSource file
    let ghcOpts = [ op | (GHC, ops) <- opts, op <- ops ]
    let pkg_incs = ["\"" ++ inc ++ "\"" | inc <- includes bi]
    let incs = nub (sort (file_incs ++ includeOpts ghcOpts ++ pkg_incs))
    let pathFlag = "-P" ++ modDir ++ [searchPathSeparator]
    let hugsArgs = "-98" : pathFlag : map ("-i" ++) incs
    cfiles <- getCFiles file
    let cArgs =
            ["-I" ++ dir | dir <- includeDirs bi] ++
            ccOptions bi ++
            cfiles ++
            ["-L" ++ dir | dir <- extraLibDirs bi] ++
            ldOptions bi ++
            ["-l" ++ lib | lib <- extraLibs bi] ++
            concat [["-framework", f] | f <- frameworks bi]
    rawSystemProgramConf verbosity ffihugsProgram (withPrograms lbi)
      (hugsArgs ++ file : cArgs)
compileFFI verbosity bi lbi modDir file = do
    (_, opts, file_incs) <- getOptionsFromSource file
    let ghcOpts = [ op | (GHC, ops) <- opts, op <- ops ]
    let pkg_incs = ["\"" ++ inc ++ "\"" | inc <- includes bi]
    let incs = nub (sort (file_incs ++ includeOpts ghcOpts ++ pkg_incs))
    let pathFlag = "-P" ++ modDir ++ [searchPathSeparator]
    let hugsArgs = "-98" : pathFlag : map ("-i" ++) incs
    cfiles <- getCFiles file
    let cArgs =
            ["-I" ++ dir | dir <- includeDirs bi] ++
            ccOptions bi ++
            cfiles ++
            ["-L" ++ dir | dir <- extraLibDirs bi] ++
            ldOptions bi ++
            ["-l" ++ lib | lib <- extraLibs bi] ++
            concat [["-framework", f] | f <- frameworks bi]
    rawSystemProgramConf verbosity ffihugsProgram (withPrograms lbi)
      (hugsArgs ++ file : cArgs)