require 'mkmf'

$PERL = ENV['PERL'] || "perl"
ccopts = `#{$PERL} -MExtUtils::Embed -e ccopts`
ldopts = `#{$PERL} -MExtUtils::Embed -e ldopts`
shrplib = `#{$PERL} -MConfig -e 'print $Config{"useshrplib"}'` == 'true'
libperl = with_config("libperl")
ccopts.chomp!
ldopts.chomp!

#$DEBUG=true
$CFLAGS=ccopts
$libs=ldopts
$CFLAGS += ' -DSHRPLIB'
if libperl
  $CFLAGS += " -DLIBPERL=\\\"#{libperl}\\\""
end

if have_header("perl.h")
#  if have_library("perl", "perl_alloc")
    create_makefile("perl")
#  end
end
