package Config_m;

require ExtUtils::FakeConfig;

my $values = <<'EOT';
cc='gcc'
ccname='gcc'
ccflags='-O2 -DWIN32 -DPERL_IMPLICIT_CONTEXT -DPERL_MSVCRT_READFIX'
cccdlflags='-DHASATTRIBUTE'
libpth='"(CC)\lib" "(CC)\i386-mingw32msvc\lib"'
libs=' -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lwsock32 -lmpr -lwinmm -lversion -lodbc32'
_a='.a'
_o='.o'
ar='ar'
cpp='gcc -E'
cppminus='-'
cpprun='gcc -E'
cppstdin='gcc -E'
d_attribut='define'
d_casti32='define'
i64type='long long'
ld='g++'
lddlflags='-s -mdll -L"(PERL)\lib\CORE"'
ldflags='-s -L"(PERL)\lib\CORE"'
lib_ext='.a'
libc='-lmsvcrt'
libperl='libperl510.a'
longdblsize='12'
lseektype='long long'
make='(MAKE)'
nm='nm'
obj_ext='.o'
optimize='-O2'
perlpath='(PERL)\bin\perl.exe'
perllibs=' -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lwsock32 -lmpr -lwinmm -lversion -lodbc32'
quadtype='long long'
u64type='unsigned long long'
uquadtype='unsigned long long'

EOT

# should these be overridable by the user?
my $cc_p = ( ExtUtils::FakeConfig::find_program( 'gcc' ) )[0];
$cc_p || warn "Unable to find compiler 'gcc'";
$cc_p =~ s/[\\\/]bin[\\\/]?$//;
my $nmake = ( ExtUtils::FakeConfig::find_program( 'nmake' ) )[1];
my $dmake = ( ExtUtils::FakeConfig::find_program( 'dmake' ) )[1];

my %values = ( CC   => $cc_p,
               PERL => $Config::Config{prefix},
               MAKE => $nmake || $dmake,
               );

$values =~ s/\((\w+)\)/$values{$1}/ge;

my @arr = $values =~ m/^(\w+)\=[\'\"](.+)[\'\"]$/mg;

eval 'use ExtUtils::FakeConfig @arr';

1;
