AFS-Monitor

 view release on metacpan or  search on metacpan

src/Makefile.PL  view on Meta::CPAN

$d_flag = '-D' . $d_flag;
$d_flag .= ' -DRXDEBUG';

# determine the alpha_sys value
my $alpha_sys = `$AFSPath/bin/fs sysname 2>&1` || 'unknown';
if ($alpha_sys =~ s/Current sysname (list|) is? //) {
  $alpha_sys =~ /(\w+)/;
  $alpha_sys = $1;
}

# print out a summary of determined data
print "Your AFS system library is located at:  $AFSPath \n";
print "              and it is major version:  $version \n";
print "Your AFS system type seems to be:       $alpha_sys \n\n";

# set the Makefile values
my %MakefileArgs = (
    'NAME'         => 'AFS::Monitor',
    'VERSION'      => "$VERSION",
    'DEFINE'	   => "$d_flag $a_flag",
    'INC'          => "-I$AFSPath/include",
    'LIBS'         => [
                       "-L$AFSPath/lib -L$AFSPath/lib/afs "
                       . join (
                                   " ", qw(
                                           -lfsprobe
                                           -lvolser
                                           -lvldb

                                           -lkauth
                                           -lprot
                                           -lrx

                                           -lcmd
                                           -lubik
                                           -lauth

                                           -lrxkad
                                           -lrxstat
                                           -lxstat_fs
                                           -lxstat_cm
                                           -lafsint
                                           -lrx

                                           -lsys
                                           -ldes
                                           -llwp
                                           -lcom_err
                                           -lutil
                                           -lusd
                                           -laudit
                                          )
                              )
                      ],
    'realclean'    => {FILES => 'Makefile.bak lib'},
                   );

if ($Config{osname} =~ /aix/) {
  $MakefileArgs{LIBS}->[0] .= ' -ldl';
} elsif ($Config{osname} =~ /irix/) {
  # just the default LIBS
} elsif ($Config{osname} =~ /solaris/) {
  $MakefileArgs{DEFINE} .= ' -Dint32=afs_int32 -Duint32=afs_uint32' if $alpha_sys eq 'sun4x_56'; # From Peter@PSDT.com
  $MakefileArgs{LIBS}->[0] .= ' -lresolv -lsocket -lnsl -lintl -ldl';
  $MakefileArgs{CC} = 'gcc';
  #$MakefileArgs{LD} = 'gcc';
  $MakefileArgs{CCCDLFLAGS} = '-fPIC';
  $MakefileArgs{LIBS}->[0] .= " -R$AFSPath/lib";
} elsif ($Config{osname} =~ /linux/) {
  $MakefileArgs{LIBS}->[0] .= ' -lresolv';
###  $MakefileArgs{LDFLAGS} = "-Wl,-rpath -Wl,$AFSPath/lib";
} elsif ($Config{osname} =~ /darwin/) {
  $MakefileArgs{LDDLFLAGS} = $Config{lddlflags} . ' -lresolv -multiply_defined suppress -read_only_relocs suppress';
}
# elsif ($Config{osname} =~ /dec_osf/) {
# # hier fehlt noch was !!!!!
# }
else {
  warn("System type '$Config{osname}' not yet tested with this Makefile.PL...\n\n"
       . "Using the default values, which may or may not work\n"
       . "If it is working, please inform the maintainer of this package.\n"
       . "Thank you.\n\n");
}

WriteMakefile(%MakefileArgs);

# change the library name of the AFS system library "util.a"
my $command = "\'s#-lutil#$AFSPath/lib/afs/util.a#\'";
system("perl -p -i.bak -e $command Makefile") unless -f "$AFSPath/lib/afs/libutil.a";

# change the library name of the AFS system library "vlib.a"
$command = "\'s#-lvlib#$AFSPath/lib/afs/vlib.a#\'";
system("perl -p -i.bak -e $command Makefile") unless -f "$AFSPath/lib/afs/libvlib.a";

# change the library name of the AFS system library "libcom_err"
$command = "\'s#-lcom_err#$AFSPath/lib/afs/libcom_err.a#\'";
system("perl -p -i.bak -e $command Makefile");

# change the library name of the AFS system library "libsys"
$command = "\'s#-lsys#$AFSPath/lib/afs/libsys.a#\'";
system("perl -p -i.bak -e $command Makefile");

# change the library name of the AFS system library "libcmd"
$command = "\'s#-lcmd#$AFSPath/lib/afs/libcmd.a#\'";
system("perl -p -i.bak -e $command Makefile");

# make changes to the typemap file if Perl < 5.6.0
$command = "\'s#T_UV#T_IV#\'";
system("perl -p -i.bak -e $command typemap") unless $] >= 5.006;



sub version {
  my ($testver, $compver) = @_;

  $compver = $ENV{VERSION} unless defined $compver;

  # Remove possible package name from both strings.
  $testver =~ s/^([a-zA-Z][^-]*-)*//;
  $compver =~ s/^([a-zA-Z][^-]*-)*//;

  for my $char ('-', '\.') {
    if ("$testver$compver" =~ /$char/) {
      my @testlist = split(/$char/, $testver);
      my @complist = split(/$char/, $compver);

      my $result = 0;
      for my $comp (@complist) {
        my $test = shift(@testlist);

        return $result unless defined $test;

        $result = version($test, $comp);
        return $result unless $result == 0;
      }
      return $result;
    }
  }

   if ("$testver$compver" =~ /^\d+$/) { return $compver <=> $testver }



( run in 1.090 second using v1.01-cache-2.11-cpan-39bf76dae61 )