Expunge revision histories in files.
[catacomb-perl] / Makefile.PL
1 # -*-perl-*-
2 #
3 # $Id: Makefile.PL,v 1.2 2004/04/08 01:36:21 mdw Exp $
4 #
5 # Makefile for Catacomb/Perl
6 #
7 # (c) 2000 Straylight/Edgeware
8 #
9
10 #----- Licensing notice -----------------------------------------------------
11 #
12 # This file is part of the Perl interface to Catacomb.
13 #
14 # Catacomb/Perl is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18 #
19 # Catacomb/Perl is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with Catacomb/Perl; if not, write to the Free Software Foundation,
26 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
28 use ExtUtils::MakeMaker;
29 use Config;
30
31 WriteMakefile(NAME => "Catacomb",
32 DISTNAME => "catacomb-perl",
33 AUTHOR => "Mark Wooding (mdw\@nsict.org)",
34 OPTIMIZE => "-O2 -g",
35 XS => { "catacomb.xs" => "catacomb.c" },
36 OBJECT => join(" ", grep { s/$/$Config{_o}/ }
37 @{[qw(algs mpstuff catacomb algstuff
38 pgproc utils)]}),
39 CONFIGURE => \&configure,
40 PL_FILES => { 'algs.PL' => 'algs.c' },
41 depend => { '$(MAKEFILE)' => '$(VERSION_FROM)',
42 'catacomb.c' =>
43 join(" ", grep { s/$/.xs/ }
44 @{[qw(catacomb algorithms mp misc pgen)]})
45 },
46 VERSION_FROM => "Catacomb.pm");
47
48 sub libconfig_item {
49 my $lib = shift;
50 my $what = shift;
51 my $out = `$lib-config --$what`;
52 $? and die("nonzero exit status from $lib-config --$what");
53 chomp $out;
54 $config{$what} .= " " if defined($config{$what});
55 $config{$what} .= $out;
56 }
57
58 sub libconfig {
59 my $lib = shift;
60 my $version = shift;
61
62 system("$lib-config --check $version")
63 and die("$lib version $version not found");
64 libconfig_item($lib, "cflags");
65 libconfig_item($lib, "libs");
66 }
67
68 sub configure {
69 local %config;
70 libconfig("mLib", "2.0.0pre4");
71 libconfig("catacomb", "2.0.0pre8");
72 return { CCFLAGS => $config{cflags},
73 LIBS => [ $config{libs} ] };
74 }
75
76 #----- That's all, folks ----------------------------------------------------