+#elif HAVE_REGEX_H && HAVE_REGCOMP
+foreign import ccall unsafe "regex.h regcomp"
+ c_regcomp :: Ptr CRegex -> CString -> CInt -> IO CInt
+
+foreign import ccall unsafe "regex.h ®free"
+ ptr_regfree :: FunPtr (Ptr CRegex -> IO ())
+
+foreign import ccall unsafe "regex.h regexec"
+ c_regexec :: Ptr CRegex -> CString -> CSize
+ -> Ptr CRegMatch -> CInt -> IO CInt
+#else
+foreign import ccall unsafe "regex/regex.h regcomp"
+ c_regcomp :: Ptr CRegex -> CString -> CInt -> IO CInt
+
+foreign import ccall unsafe "regex/regex.h ®free"
+ ptr_regfree :: FunPtr (Ptr CRegex -> IO ())
+
+foreign import ccall unsafe "regex/regex.h regexec"
+ c_regexec :: Ptr CRegex -> CString -> CSize
+ -> Ptr CRegMatch -> CInt -> IO CInt
+#endif