AFS-Monitor

 view release on metacpan or  search on metacpan

src/Makefile.PL  view on Meta::CPAN

#------------------------------------------------------------------------------
# RCS-Id: "@(#)$Id: Makefile.PL,v 1.21 2007/05/14 18:24:17 alfw Exp $"
#
# Copyright © 2001-2004 Norbert E. Gruener <nog@MPA-Garching.MPG.de>
#             2004-2006 Alf Wachsmann <alfw@slac.stanford.edu>
#                       and Elizabeth Cassell
# This library is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#------------------------------------------------------------------------------

use strict;
use English;

use ExtUtils::MakeMaker;
use Config;

my $archname = $Config{'archname'};
# if ($archname =~ /thread/i) { die "Threaded Perl is not supported ...\n"; }

my $VERSION = "0.3.2";

# give me the path to the AFS system libraries
# used to build the AFS extension module
my $guess_path;
if    (-r "/usr/local/include/afs/afs.h") { $guess_path = '/usr/local'; }
elsif (-r "/usr/afsws/include/afs/afs.h") { $guess_path = '/usr/afsws'; }
elsif (-r "/usr/include/afs/afs.h")       { $guess_path = '/usr'; }
elsif (-r "/Library/OpenAFS/Tools/include/afs/afs.h") { $guess_path = '/Library/OpenAFS/Tools'; }

my $AFSPath;
if (defined $ENV{AFSPATH}) {
  $AFSPath = $ENV{AFSPATH};
} else {
  my $mess = "\nPath to the AFS installation (libraries, binaries, \n"
           . "header files) to be used for this installation? \t$AFSPath] ";
  $AFSPath = prompt($mess, $guess_path);
}

$AFSPath =~ s\/$\\;

# find out the AFS version of the AFS system libraries
open FILE, ">fotav.c";
print FILE <<'EOF';

#include <stdio.h>

int main(void) {
  extern char *AFSVersion;
  printf(">%s<\n",AFSVersion);
}
EOF
close FILE;

system("$Config::Config{cc} fotav.c -L$AFSPath/lib -lubik");
if ($CHILD_ERROR) {
  unlink 'fotav.c';
  die "\nCould not compile test code to retrieve the version of AFS system libraries...\n";
}
my $version = `./a.out` || die "\nCould not run test code to retrieve the version of AFS system libraries...\n";
unlink 'a.out', 'fotav.c';
print "AFS Version = $version \n";

if ($version =~ /3.[4,5]/) {
  die("This release does not support AFS 3.4/3.5 system libraries ...\n");
}

# set the compiler flag "-D$version" according to the AFS version
my ($d_flag, $a_flag) = ('', '');
if    ($version =~ /3.4/)   { $d_flag = 'AFS 3.4'; }
elsif ($version =~ /3.5/)   { $d_flag = 'AFS 3.5'; }
elsif ($version =~ /3.6/)   { $d_flag = 'AFS 3.6'; }
elsif ($version =~ /1.0/)   { $d_flag = 'OpenAFS 1.0'; }
elsif ($version =~ /1.1/)   { $d_flag = 'OpenAFS 1.1'; }
elsif ($version =~ /1.2/)   { $d_flag = 'OpenAFS 1.2'; }
elsif ($version =~ /1.4/)   { $d_flag = 'OpenAFS 1.4'; }
elsif ($version =~ /devel/) { $d_flag = 'OpenAFS devel'; }

if ($version =~ /openafs/)  { $a_flag = '-DOpenAFS'; }



( run in 1.419 second using v1.01-cache-2.11-cpan-677af5a14d3 )