diff --git a/HsPerl5.cabal b/HsPerl5.cabal
--- a/HsPerl5.cabal
+++ b/HsPerl5.cabal
@@ -1,5 +1,5 @@
 name:               HsPerl5
-version:            0.0.3
+version:            0.0.4
 copyright:          2008 Audrey Tang
 license:            BSD3
 license-file:       LICENSE
@@ -28,7 +28,7 @@
                     UndecidableInstances, OverlappingInstances, IncoherentInstances
 exposed-modules:    Language.Perl5
 build-depends:      base
-extra-source-files: README test.hs configure
+extra-source-files: README test.hs configure p5embed.h
 hs-source-dirs:     src
 category:           Language
 c-sources:          p5embed.c
diff --git a/Setup.lhs b/Setup.lhs
--- a/Setup.lhs
+++ b/Setup.lhs
@@ -1,3 +1,3 @@
 #!/usr/bin/env runghc
 > import Distribution.Simple
-> main = defaultMainWithHooks autoconfUserHooks
+> main = defaultMainWithHooks defaultUserHooks
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 
-/usr/bin/perl << CONFIGURE
+perl << CONFIGURE
 
 use ExtUtils::Embed;
 
@@ -9,10 +9,16 @@
 my @ldoptions   = split(/\s+/, ldopts());
 s/^-I// for @includedirs;
 
+my \$info = << ".";
+cc-options: @ccoptions
+ld-options: @ldoptions
+include-dirs: @includedirs
+.
+
+\$info =~ s/-arch\s+\w+\s*//g;
+
 open INFO, ">HsPerl5.buildinfo" or die "Cannot write build info";
-print INFO "cc-options: @ccoptions\n";
-print INFO "ld-options: @ldoptions\n";
-print INFO "include-dirs: @includedirs\n";
+print INFO \$info;
 close INFO;
 
 xsinit();
diff --git a/p5embed.h b/p5embed.h
new file mode 100644
--- /dev/null
+++ b/p5embed.h
@@ -0,0 +1,45 @@
+#ifndef HsPerl5DefinedH
+#define HsPerl5DefinedH 1
+
+#define dirent DIRENT
+#define _INTPTR_T_DEFINED
+#define _UINTPTR_T_DEFINED
+#undef RETURN
+
+#if defined(__OpenBSD__)
+#define _P5EMBED_INIT _p5embed_init
+#else
+#define _P5EMBED_INIT __init
+#endif
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "embed.h"
+
+/*
+PerlInterpreter * perl5_init ( int argc, char **argv );
+bool perl5_SvROK(SV *inv);
+bool perl5_can(SV *inv, char *subname);
+*/
+SV * perl5_sv_undef ();
+SV * perl5_sv_yes ();
+SV * perl5_sv_no ();
+SV ** perl5_eval(char *code, int len, int cxt);
+char * perl5_SvPV ( SV * sv );
+SV * perl5_newSVpvn ( char * pv, int len );
+SV ** perl5_return_conv (int count);
+SV ** perl5_apply(SV *sub, SV *inv, SV** args, int cxt);
+SV * perl5_newSViv ( int iv );
+int perl5_SvIV ( SV * sv );
+double perl5_SvNV ( SV * sv );
+SV * perl5_newSVnv ( double iv );
+bool perl5_SvTRUE ( SV * sv );
+SV * perl5_get_sv ( const char *name );
+SV * perl5_get_cv ( const char *name );
+
+
+#include <HsFFI.h>
+extern SV ** hsPerl5Apply ( HsStablePtr *sub, SV **args, int cxt );
+SV * perl5_make_cv ( HsStablePtr *sub );
+
+#endif
