From 0c1ebc951291423598c18d3ba909927b561ca7bc Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Fri, 15 Apr 2016 15:48:13 +1000 Subject: [PATCH] try probing for a valid ivdformat if the %Config value is bad --- Makefile.PL | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index aa5c8c14..835ecb6f 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -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 => <