File: Makefile.PL

package info (click to toggle)
libcflow-perl 1.051-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 204 kB
  • ctags: 86
  • sloc: perl: 401; ansic: 55; makefile: 44
file content (75 lines) | stat: -rw-r--r-- 2,298 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# -*- mode:perl -*-
# $Id: Makefile.PL,v 1.10 2002/01/11 22:23:26 dplonka Exp $

require 5.003; # for INSTALLSCRIPT

# use Config;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    # ABSTRACT_FROM  => 'Cflow.pm',
    # AUTHOR         => 'Dave Plonka <plonka@doit.wisc.edu>',
    CONFIGURE      => \&find_argus_or_flow_tools,
    EXE_FILES      => [ 'flowdumper' ],
    NAME           => 'Cflow',
    PM             => {
			 'Cflow.pm' => '$(INST_LIBDIR)/Cflow.pm',
		      },
    VERSION_FROM   => 'Cflow.pm', # finds $VERSION
    clean          => { FILES => '$(EXE_FILES)' },
    dist           => {
                         'COMPRESS' =>  'gzip',
                         'SUFFIX' => 'gz',
                      },
);

sub find_argus_or_flow_tools {
   my $hv;
   # for the time being, argus and flow-tools are mutually exclusive.
   # (No good reason... Its just the way "Cflow.xs" was written.)
   if ($hv = &find_argus) {
      return $hv
   } elsif ($hv = &find_flow_tools) {
      return $hv
   } else {
      # neither found... cflowd support only.
      return { INC     => join(' ', $incdir),
	       LIBS    => [ join(' ', $libdir, '-lnsl') ] }
   }
}

sub find_flow_tools {
   my($ver, $dir);
   my($libdir, $incdir);
   if (-f '../../lib/libft.a') {
      $dir = '../../lib';
      $incdir = "-I$dir -I$dir/..";
      $libdir = "-L$dir";
   }
   if ("$libdir") {
      print "Found flow-tools... using \"-DOSU $incdir $libdir -lft -lz\".\n";
      return { CCFLAGS => '-DOSU',
	       INC     => join(' ', $incdir),
	       LIBS    => [ join(' ', $libdir, '-lnsl -lft -lz') ] }
   }
   return undef
}

sub find_argus {
   my($ver, $dir);
   my($libdir, $incdir);
   if (-f '../../lib/argus_common.a' && -f '../../lib/argus_parse.a') {
      $dir = '../../lib';
      $incdir = "-I$dir/../include";
      $libdir = "-L$dir";
   }
   if ("$libdir") {
      print "Found argus... using \"-DARGUS $incdir $dir/argus_common.a $dir/argus_parse.a\".\n";
      return { CCFLAGS => '-DARGUS',
	       INC     => join(' ', $incdir),
	       LIBS    => [ join(' ', $libdir, '-lnsl', '-lm') ],
	       LDFROM  => "\$(OBJECT) $dir/argus_common.a $dir/argus_parse.a" }
   }
   return undef
}