+# at least one CPAN tester has an incorrect ivdformat, make sure it's
+# valid
+sub probe_ivdformat {
+ if (_test_ivdformat($Config{ivdformat})) {
+ return $Config{ivdformat};
+ }
+ die "OS unsupported: Invalid ivdformat ($Config{ivdformat}) in this perl\n";
+}
+
+sub _test_ivdformat {
+ my ($fmt) = @_;
+ require Devel::CheckLib;
+ my $good =
+ Devel::CheckLib::check_lib
+ (
+ debug => $VERBOSE,
+ LIBS => [],
+ INC => "",
+ header => [ "stdio.h", "string.h" ],
+ function => <<CODE,
+char buf[80];
+$Config{ivtype} x = 10;
+sprintf(buf, "%" $fmt " %" $fmt, x, x);
+if (strcmp(buf, "10 10")) {
+ printf("ivformat: " $fmt " is invalid\n");
+ return 1;
+}
+CODE
+ );
+}
+