Comment.
[ZOOM-Perl-moved-to-github.git] / Makefile.PL
1 # $Id: Makefile.PL,v 1.22 2007-09-14 10:36:43 mike Exp $
2
3 # Use: perl Makefile.PL OPTIMIZE="-O0 -g -Wdeclaration-after-statement"
4
5 use 5.008;
6 use ExtUtils::MakeMaker;
7 use strict;
8
9 my $yazver = `yaz-config --version`;
10 my $yazinc = `yaz-config --cflags threads`;
11 my $yazlibs = `yaz-config --libs threads`;
12 if (!$yazver || !$yazinc || !$yazlibs) {
13     die qq[
14 ERROR: Unable to call script: yaz-config
15 If you are using a YAZ installation from the Debian package "yaz", you
16 will also need to install "libyaz-dev" in order to build this module.
17 ];
18 }
19
20 chomp($yazver);
21 check_version($yazver, "2.1.50");
22
23 # For Windows use
24 # $yazinc = '-Ic:\yaz\include'
25 # $yazlibs = 'c:\yaz\lib\yaz.lib'
26
27 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
28 # the contents of the Makefile that is written.
29 WriteMakefile(
30     NAME              => 'Net::Z3950::ZOOM',
31     VERSION_FROM      => 'lib/Net/Z3950/ZOOM.pm', # finds $VERSION
32     PREREQ_PM         => { "MARC::Record" => 1.38 },
33     ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
34       (ABSTRACT_FROM  => 'lib/Net/Z3950/ZOOM.pm', # retrieve abstract from module
35        AUTHOR         => 'Mike Taylor <mike@>') : ()),
36     LIBS              => [ $yazlibs ], # e.g., '-lm'
37     DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
38         # Insert -I. if you add *.h files later:
39     INC               => $yazinc, # e.g., '-I/usr/include/other'
40         # Un-comment this if you add C files to link with later:
41     # OBJECT            => '$(O_FILES)', # link all the C files too
42 # Use this to test for illegal code that GCC stupidly permits by default:
43 #   OPTIMIZE          => "-Wdeclaration-after-statement -g -O0",
44     EXE_FILES    => [ 'samples/zoom/zselect' ],
45 );
46
47
48 sub check_version {
49     my($got, $want) = @_;
50
51     my($gmajor, $gminor, $gtrivial) = ($got =~ /(\d+)\.(\d+)\.(\d+)/);
52     my($wmajor, $wminor, $wtrivial) = ($want =~ /(\d+)\.(\d+)\.(\d+)/);
53     if (($gmajor < $wmajor) ||
54         ($gmajor == $wmajor && $gminor < $wminor) ||
55         ($gmajor == $wmajor && $gminor == $wminor && $gtrivial < $wtrivial)) {
56         print <<__EOT__;
57 *** ERROR!
58 ZOOM-Perl requires at least version $want of YAZ,
59 but you only have version $got.
60 __EOT__
61         exit 1;
62     }
63 }