-my $unit = 8;
-if (unpack("h*", pack("s", 0x1234)) != 4321) {
- print "Forcing unit size of 8 on non-little-endian systems.\n";
-} else {
- my $align = int($Config{alignbytes} || 0);
- print "Checking unit size in bits... ";
- my @s = (8, 16, 32);
- push @s, 64 unless $^O eq 'MSWin32';
- for (@s) {
- my $size = int($Config{'u' . $_ . 'size'} || 0);
- $unit = $_ if $size && $size <= $align;
+
+if (defined $cc and defined $ld) {
+ $PARAMS{C} = [ 'Util.c' ];
+ $PARAMS{XS} = { 'Util.xs' => 'Util.c' };
+ $PARAMS{CC} = $cc;
+ $PARAMS{LD} = $ld;
+
+ my $unit = { bits => 8, size => 1 };
+ if (not is_little_endian()) {
+ print "Forcing unit size of 8 on non-little-endian systems.\n";
+ } else {
+ print "Checking unit size in bits... ";
+ my $align = $Config{alignbytes} || 1;
+ my @bits = (8, 16, 32, 64);
+ for my $bits (@bits) {
+ my $size = $Config{"u${bits}size"};
+ next unless $size;
+ $unit = { bits => $bits, size => $size } if $size && $size <= $align;
+ }
+ print $unit->{bits},
+ " (actually $unit->{size} bytes for $align bytes alignment).\n";