Subject: | cygwin perl5.8 fixes |
gcc -O3 fails with hack30
internal compiler error: in convert_move, at expr.c:597
better fixes for the cygwin tests: -lc and -lm
--- C-DynaLib-0.55/Makefile.PL.orig 1998-04-29 22:51:44.000000000 +0000
+++ C-DynaLib-0.55/Makefile.PL 2005-06-30 07:41:06.914750000 +0000
@@ -71,6 +71,7 @@
}
'alpha'} ],
[ 'win32', sub {'cdecl'} ],
+# [ 'cygwin', sub {'cdecl'} ],
[ '', sub { () } ],
)
{ @convention = &{$_->[1]}, last if $archname =~ /$_->[0]/i }
@@ -159,10 +160,10 @@
return &$cant unless $self->{how_to_compile};
@candidate = ();
- push @candidate, "testtest$self->{EXE_EXT} >/dev/null 2>&1"
- unless $Verbose;
push @candidate, "./testtest$self->{EXE_EXT} >/dev/null 2>&1"
unless $Verbose;
+ push @candidate, "testtest$self->{EXE_EXT} >/dev/null 2>&1"
+ unless $Verbose;
push @candidate, "testtest$self->{EXE_EXT}";
push @candidate, "./testtest$self->{EXE_EXT}";
push @candidate, "run testtest$self->{EXE_EXT}";
@@ -261,7 +262,7 @@
print "Using calling convention(s): @convention\n"
if $Verbose;
- for (@convention) { $cflags{"-DDYNALIB_USE_$_"} = undef }
+ for (@convention) { $cflags{"-DDYNALIB_USE_$_"} = undef; }
print "Default calling convention: $convention[0]\n"
if $Verbose;
--- C-DynaLib-0.55/README.orig 2000-02-12 02:47:14.000000000 +0000
+++ C-DynaLib-0.55/README 2005-06-30 07:42:30.914750000 +0000
@@ -57,6 +57,8 @@
build, try `perl Makefile.PL CALLBACKS=0' followed by `make test',
and tell me of your success or failure.
+perl with gcc 3.3.3 and -O3 and hack30 will require at least
+make OPTIMIZE=
COPYRIGHT
--- C-DynaLib-0.55/test.pl.orig 1998-04-29 23:02:18.000000000 +0000
+++ C-DynaLib-0.55/test.pl 2005-06-30 06:50:08.930375000 +0000
@@ -47,8 +47,13 @@
$libc = new C::DynaLib($Config{'libc'} || "-lc");
if (! $libc) {
- if ($^O =~ /win32/i) {
- $libc = new C::DynaLib("MSVCRT40") || new C::DynaLib("MSVCRT20");
+ # cygwin has no shared libc.so, just static. same for libm.so
+ if ($^O eq 'cygwin') {
+ $libc = new C::DynaLib("cygwin1");
+ } elsif ($^O =~ /(MSWin32)/) {
+ $libc = new C::DynaLib("MSVCRT.DLL")
+ || new C::DynaLib("MSVCRT40")
+ || new C::DynaLib("MSVCRT20");
} elsif ($^O =~ /linux/i) {
# Some glibc versions install "libc.so" as a linker script,
# unintelligible to dlopen().
@@ -65,7 +70,10 @@
$libm = $libc;
} elsif ($libm_arg !~ /libm\.a$/) {
$libm = new C::DynaLib("-lm");
+} elsif ($^O eq 'cygwin') {
+ $libm = new C::DynaLib("cygwin1");
}
+
$libm and $pow = $libm->DeclareSub ({ "name" => "pow",
"return" => "d",
"args" => ["d", "d"],
@@ -197,12 +205,15 @@
$got = &$sub(-1);
# Can't do this because it's broken in too many Perl versions:
- # $expected = unpack("I", pack("i", -1));
+ if ($^O eq 'cygwin') {
+ $expected = unpack("I", pack("i", -1));
+ } else {
$expected = 0;
for ($i = 1; $i > 0; $i <<= 1) {
$expected += $i;
}
$expected -= $i;
+ }
assert(1, $got, $expected);
$int_size = length(pack("i",0));