Initial checkin.
[catacomb-perl] / Makefile.PL
CommitLineData
660b443c 1# -*-perl-*-
2#
3# $Id: Makefile.PL,v 1.1 2004/04/02 18:04:01 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#----- Revision history -----------------------------------------------------
29#
30# $Log: Makefile.PL,v $
31# Revision 1.1 2004/04/02 18:04:01 mdw
32# Initial checkin.
33#
34
35use ExtUtils::MakeMaker;
36use Config;
37
38WriteMakefile(NAME => "Catacomb",
39 DISTNAME => "catacomb-perl",
40 AUTHOR => "Mark Wooding (mdw\@nsict.org)",
41 OPTIMIZE => "-O2 -g",
42 XS => { "catacomb.xs" => "catacomb.c" },
43 OBJECT => join(" ", grep { s/$/$Config{_o}/ }
44 @{[qw(algs mpstuff catacomb algstuff
45 pgproc utils)]}),
46 CONFIGURE => \&configure,
47 PL_FILES => { 'algs.PL' => 'algs.c' },
48 depend => { '$(MAKEFILE)' => '$(VERSION_FROM)',
49 'catacomb.c' =>
50 join(" ", grep { s/$/.xs/ }
51 @{[qw(catacomb algorithms mp misc pgen)]})
52 },
53 VERSION_FROM => "Catacomb.pm");
54
55sub libconfig_item {
56 my $lib = shift;
57 my $what = shift;
58 my $out = `$lib-config --$what`;
59 $? and die("nonzero exit status from $lib-config --$what");
60 chomp $out;
61 $config{$what} .= " " if defined($config{$what});
62 $config{$what} .= $out;
63}
64
65sub libconfig {
66 my $lib = shift;
67 my $version = shift;
68
69 system("$lib-config --check $version")
70 and die("$lib version $version not found");
71 libconfig_item($lib, "cflags");
72 libconfig_item($lib, "libs");
73}
74
75sub configure {
76 local %config;
77 libconfig("mLib", "2.0.0pre4");
78 libconfig("catacomb", "2.0.0pre8");
79 return { CCFLAGS => $config{cflags},
80 LIBS => [ $config{libs} ] };
81}
82
83#----- That's all, folks ----------------------------------------------------