add test code for the JPEG probe
authorTony Cook <tony@develop=help.com>
Mon, 13 Sep 2010 10:16:45 +0000 (10:16 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 13 Sep 2010 10:16:45 +0000 (10:16 +0000)
Changes
JPEG/Makefile.PL
inc/Devel/CheckLib.pm

diff --git a/Changes b/Changes
index 1305f8fdf1c74e7fc56b223a768d7be085b44887..e5b2d16a0bd8ec7428ab5757f8e68ceac75a8b11 100644 (file)
--- a/Changes
+++ b/Changes
@@ -26,10 +26,10 @@ Bug fixes:
    https://rt.cpan.org/Ticket/Display.html?id=60509
 
  - fix the cache check for the X rgb.txt loader.  This is typically
-   used for color translation on Unix-like systems, and improves
-   performance of supplying colors by name by about 80 times.  Test
-   code that managed 3400 10x10 pixel boxes/second sped up to 25700
-   boxes/second.
+   used for color translation on Unix-like systems, and the fix
+   improves performance of supplying colors by name by about 80 times.
+   Test code that managed 3400 10x10 pixel boxes/second sped up to
+   25700 boxes/second.
 
  - clarify that Imager doesn't write EXIF metadata to images.
    https://rt.cpan.org/Ticket/Display.html?id=60637
index 7606b439fcca150d5e9e8af639247efab4f17ee5..270fa11d33c0d0f17d78e21f492211dad29f875e 100644 (file)
@@ -74,8 +74,8 @@ my %probe =
    name => "JPEG",
    inccheck => sub { -e File::Spec->catfile($_[0], "jpeglib.h") },
    libbase => "jpeg",
-   #testcode => _jpeg_test_code(),
-   #testcodeheaders => [ "stdio.h", "stddef.h", "jpeglib.h", "jerror.h" ],
+   testcode => _jpeg_test_code(),
+   testcodeheaders => [ "stdio.h", "stddef.h", "jpeglib.h" ],
    incpath => join($Config{path_sep}, @incpaths),
    libpath => join($Config{path_sep}, @libpaths),
   );
@@ -106,8 +106,12 @@ else {
 
 sub _jpeg_test_code {
   return <<'CODE';
+struct jpeg_decompress_struct cinfo;
+struct jpeg_error_mgr jerr;
+
+cinfo.err = jpeg_std_error(&jerr);
+jpeg_create_decompress(&cinfo);
 
-/*fprintf(stderr, "PNG: library version %ld, header version %ld\n", (long)png_access_version_number(),  (long)PNG_LIBPNG_VER);*/
 return 0;
 CODE
 }
index 92db0c0f74e5b1586dd400ed2c3a5515699680a3..9d02547f2e25d6a1d10f7def543f0e7ed0ca9db5 100644 (file)
@@ -234,11 +234,14 @@ sub assert_lib {
     my @wrongresult;
 
     # first figure out which headers we can't find ...
+    my @use_headers;
     for my $header (@headers) {
+        push @use_headers, $header;
         my($ch, $cfile) = File::Temp::tempfile(
             'assertlibXXXXXXXX', SUFFIX => '.c'
         );
-        print $ch qq{#include <$header>\nint main(void) { return 0; }\n};
+        print $ch qq{#include <$_>\n} for @use_headers;
+        print $ch qq{int main(void) { return 0; }\n};
         close($ch);
         my $exefile = File::Temp::mktemp( 'assertlibXXXXXXXX' ) . $Config{_exe};
         my @sys_cmd;