Use connection-level diagnostic if there is no record.
[irspy-moved-to-github.git] / Makefile.PL
1 # $Id: Makefile.PL,v 1.14 2007-05-09 12:04:36 mike Exp $
2
3 use 5.008;
4 use strict;
5 use warnings;
6 use ExtUtils::MakeMaker;
7
8 my $yazver = `yaz-config --version`;
9 if (!$yazver) {
10     die qq[
11 ERROR: Unable to call script: yaz-config
12 If you are using a YAZ installation from the Debian package "yaz", you
13 will also need to install "libyaz-dev" in order to build this module.
14 ];
15 }
16
17 chomp($yazver);
18 # 2.1.53 is the first version with ZOOM-C fixed to properly support
19 # reconnection in asynchronous mode.
20 check_version($yazver, "2.1.53");
21
22 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
23 # the contents of the Makefile that is written.
24 WriteMakefile(
25     NAME              => 'ZOOM::IRSpy',
26     VERSION_FROM      => 'lib/ZOOM/IRSpy.pm', # finds $VERSION
27     PREREQ_PM         => {
28         "Net::Z3950::ZOOM" => 1.19,
29         "XML::LibXML::XPathContext" => 0.07, # For Web UI
30         "XML::LibXML" => 1.58,
31         "XML::LibXSLT" => 1.57,
32         "URI::Escape" => 3.28, # For Web UI
33     },
34     ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
35       (ABSTRACT_FROM  => 'lib/ZOOM/IRSpy.pm', # retrieve abstract from module
36        AUTHOR         => 'Mike Taylor <mike@indexdata.com>') : ()),
37 );
38
39
40 sub check_version {
41     my($got, $want) = @_;
42
43     my($gmajor, $gminor, $gtrivial) = ($got =~ /(\d+)\.(\d+)\.(\d+)/);
44     my($wmajor, $wminor, $wtrivial) = ($want =~ /(\d+)\.(\d+)\.(\d+)/);
45     if (($gmajor < $wmajor) ||
46         ($gmajor == $wmajor && $gminor < $wminor) ||
47         ($gmajor == $wmajor && $gminor == $wminor && $gtrivial < $wtrivial)) {
48         print <<__EOT__;
49 *** ERROR!
50 ZOOM-Perl requires at least version $want of YAZ,
51 but is currently you only have version $got.
52 __EOT__
53         exit 1;
54     }
55 }