[project @ 2004-07-30 23:29:41 by ross]
[ghc-base.git] / Text / Regex / Posix.hsc
index 65ab13d..8cda010 100644 (file)
@@ -13,6 +13,7 @@
 -----------------------------------------------------------------------------
 
 -- ToDo: should have an interface using PackedStrings.
+#include "config.h"
 
 module Text.Regex.Posix (
        -- * The @Regex@ type
@@ -37,13 +38,25 @@ module Text.Regex.Posix (
   ) where
 
 #include <sys/types.h>
+
+#if HAVE_REGEX_H && HAVE_REGCOMP
 #include "regex.h"
+#else
+#include "regex/regex.h"
+{-# CBITS regex/reallocf.c #-}
+{-# CBITS regex/regcomp.c #-}
+{-# CBITS regex/regerror.c #-}
+{-# CBITS regex/regexec.c #-}
+{-# CBITS regex/regfree.c #-}
+#endif
 
 import Prelude
 
 import Foreign
 import Foreign.C
 
+type CRegex    = ()
+
 -- | A compiled regular expression
 newtype Regex = Regex (ForeignPtr CRegex)
 
@@ -154,7 +167,6 @@ unpack string p_match = do
        REG_ERANGE, \
        REG_ESPACE
 
-type CRegex    = ()
 type CRegMatch = ()
 
 foreign import ccall unsafe "regcomp"