]> git.imager.perl.org - imager.git/commitdiff
try probing for a valid ivdformat if the %Config value is bad
authorTony Cook <tony@develop-help.com>
Fri, 15 Apr 2016 05:48:13 +0000 (15:48 +1000)
committerTony Cook <tony@develop-help.com>
Fri, 15 Apr 2016 05:48:13 +0000 (15:48 +1000)
Makefile.PL

index aa5c8c147d86c8009f01d50ab6b8b2ff00bcb89a..835ecb6f67027bd77640cab3af82cfbd906b9f91 100644 (file)
@@ -644,24 +644,36 @@ EOS
 }
 
 # at least one CPAN tester has an incorrect ivdformat, make sure it's
-# valid
+# valid.
+# Or at least it isn't valid with the built-in sprintf()
 sub probe_ivdformat {
   if (_test_ivdformat($Config{ivdformat})) {
     return $Config{ivdformat};
   }
+  my @test_fmt = grep $_ ne $Config{ivdformat}, qw(ld d lld zd I64d);
+  for my $fmt (@test_fmt) {
+    if (_test_ivdformat($fmt)) {
+      print "ivdformat: Found a valid ivdformat\n";
+      return $fmt;
+    }
+  }
   die "OS unsupported: Invalid ivdformat ($Config{ivdformat}) in this perl\n";
 }
 
 sub _test_ivdformat {
   my ($fmt) = @_;
   require Devel::CheckLib;
+  my @headers = ( "stdio.h", "string.h" );
+  if ($Config{i_inttypes}) {
+    push @headers, "inttypes.h";
+  }
   my $good =
     Devel::CheckLib::check_lib
       (
        debug => $VERBOSE,
        LIBS => [],
        INC => "",
-       header => [ "stdio.h", "string.h" ],
+       header => \@headers,
        function => <<CODE,
 char buf[80];
 $Config{ivtype} x = 10;