Skip to content

Commit

Permalink
Merge pull request #4906 from attila-lendvai/cc-env
Browse files Browse the repository at this point in the history
IDRIS_CC and IDRIS_CFLAGS: fallback to the unprefixed variables
  • Loading branch information
melted committed Oct 22, 2021
2 parents 8752d86 + 22c792a commit 0d094e7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/IRTS/System.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import Paths_idris
#endif
import BuildFlags_idris

import Control.Monad (Monad, liftM2)
import Control.Applicative ((<|>))
import Data.List.Split
import Data.Maybe (fromMaybe)
import System.Environment
Expand Down Expand Up @@ -60,7 +62,7 @@ overrideIdrisSubDirWith fp envVar = do
Just ddir -> return ddir

getCC :: IO String
getCC = fromMaybe cc <$> lookupEnv "IDRIS_CC"
getCC = fromMaybe cc <$> liftM2 (<|>) (lookupEnv "IDRIS_CC") (lookupEnv "CC")
where
#ifdef mingw32_HOST_OS
cc = "gcc"
Expand All @@ -69,7 +71,8 @@ getCC = fromMaybe cc <$> lookupEnv "IDRIS_CC"
#endif

getEnvFlags :: IO [String]
getEnvFlags = maybe [] (splitOn " ") <$> lookupEnv "IDRIS_CFLAGS"
getEnvFlags = maybe [] (splitOn " ") <$> liftM2 (<|>)
(lookupEnv "IDRIS_CFLAGS") (lookupEnv "CFLAGS")


#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS)\
Expand Down

0 comments on commit 0d094e7

Please sign in to comment.