Various changes. Kinda in the middle of it here, but it seems to work.
[catacomb-perl] / Makefile.PL
1 # -*-perl-*-
2 #
3 # $Id$
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 keystuff 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 field ec
45 gf misc pgen key)]})
46 },
47 VERSION_FROM => "Catacomb.pm");
48
49 sub libconfig_item {
50 my $lib = shift;
51 my $what = shift;
52 my $out = `$lib-config --$what`;
53 $? and die("nonzero exit status from $lib-config --$what");
54 chomp $out;
55 $config{$what} .= " " if defined($config{$what});
56 $config{$what} .= $out;
57 }
58
59 sub libconfig {
60 my $lib = shift;
61 my $version = shift;
62
63 system("$lib-config --check $version")
64 and die("$lib version $version not found");
65 libconfig_item($lib, "cflags");
66 libconfig_item($lib, "libs");
67 }
68
69 sub configure {
70 local %config;
71 libconfig("mLib", "2.0.0pre4");
72 libconfig("catacomb", "2.0.0pre8");
73 return { CCFLAGS => $config{cflags},
74 LIBS => [ $config{libs} ] };
75 }
76
77 #----- That's all, folks ----------------------------------------------------