allow WITH_HOST setting too

This commit is contained in:
Joey Hess 2012-10-28 21:21:01 -04:00
parent ecea2b19cf
commit dd63cbb7bc

View file

@ -31,12 +31,14 @@ import Data.Maybe
import ADNS.Resolver
import Data.Either
#else
#ifndef WITH_HOST
#ifdef WITH_DNS
import qualified Network.DNS.Lookup as DNS
import Network.DNS.Resolver
import qualified Data.ByteString.UTF8 as B8
#endif
#endif
#endif
newtype SRV = SRV String
deriving (Show, Eq)
@ -62,6 +64,9 @@ lookupSRV (SRV srv) = initResolver [] $ \resolver -> do
resolveSRV resolver srv
return $ either (\_ -> []) id r
#else
#ifdef WITH_HOST
lookupSRV = lookupSRVHost
#else
#ifdef WITH_DNS
lookupSRV (SRV srv) = do
seed <- makeResolvSeed defaultResolvConf
@ -78,6 +83,7 @@ lookupSRV (SRV srv) = do
lookupSRV = lookupSRVHost
#endif
#endif
#endif
lookupSRVHost :: SRV -> IO [HostPort]
lookupSRVHost (SRV srv)