Makefile.PL 3.06 KB
Newer Older
1 2
use 5.008002;

3 4 5 6
use ExtUtils::MakeMaker;

use Config;

7
if ($^O eq "MSWin32") {
8 9
   # configuration on windows is hardcoded - as always

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
   print STDERR <<EOF;

***
*** Your platform is not standards compliant. To get this module working, you need to
*** download and install win32 pthread (http://sourceware.org/pthreads-win32/)
*** in /gtk/{lib,include}
*** also, the windows SDK is expected to be installed in /sdk
*** and visual C is expected to be installed in /vc98
***
*** You can set the INC and LIBS environment variables
*** accordingly before running Makeifle.PL, or you can
*** pass INC and LIBS arguments to Makefile.PL itself.
***

EOF

   $INC  = "$ENV{INC} -I/sdk/include -I/vc98/include -I/gtk/include";
   $LIBS = ["$ENV{LIBS} -L/gtk/lib -lpthreadVC2"];
28

29 30 31 32
   open my $fh, ">libeio/config.h"
      or die "libeio/config.h: $!";
   print $fh <<EOF;
EOF
33 34 35 36

} else {

   $INC  = "";
37
   $LIBS = ['-lpthread', '-lpthreads', ''];
38

39
   if ($^O =~ /bsd/i) {
40 41
      print <<EOF;

42 43 44 45 46
If you have problems with deadlocks or crashes on your system,
make sure your perl has been linked with -lpthread (you might try
LD_PRELOAD=/path/to/libpthread.so as a workaround). Also, pthread support
under many BSDs is not the best - before reporting a bug in this module,
make sure it's not an OS bug.
47 48 49 50

EOF
   }

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
   {
      local %ENV = %ENV;

      while (my ($k, $v) = each %Config) {
         $ENV{$k} = $v;
      }

      $ENV{MAKE}     = $Config{make};
      $ENV{SHELL}    = $Config{sh};
      $ENV{CC}       = $Config{cc};
      $ENV{CPPFLAGS} = $Config{cppflags};
      $ENV{CFLAGS}   = $Config{ccflags};
      $ENV{LDFLAGS}  = $Config{ldflags};
      $ENV{LINKER}   = $Config{ld}; # nonstandard

      system $ENV{SHELL}, -c => "./configure --prefix \Q$Config{prefixexp}\E"
         and exit $? >> 8;
   }
69 70 71 72 73 74 75 76
}

if ($^O =~ /linux/ && $Config{usemymalloc} eq "y") {
   print <<EOF;

***
*** WARNING:
***
77
*** Your perl uses its own memory allocator (-Dusemymalloc=y),
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
*** which is known not to be threadsafe on GNU/Linux and probably
*** other platforms (even when not used concurrently, it trashes
*** the data structures of the system malloc running concurrently),
*** for perls up to 5.8.8 and possibly later versions.
***
*** If you are unsure wether your perl has been fixed, your system
*** is safe for other reasons, or you experience spurious segfaults,
*** please compile your perl with -Dusemymalloc=n.
***

EOF
}

my $mm = MM->new({
    dist         => {
       PREOP	=> 'pod2text AIO.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;',
       COMPRESS	=> 'gzip -9v',
       SUFFIX	=> '.gz',
	            },
97 98 99
    depend => {
       "AIO.c" => "libeio/eio.h libeio/xthread.h libeio/eio.c libeio/config.h",
    },
100 101 102 103
    NAME         => "IO::AIO",
    VERSION_FROM => "AIO.pm",
    INC          => $INC,
    LIBS         => $LIBS,
104
    EXE_FILES    => ["bin/treescan"],
105 106 107
    PM           => {
    		    'AIO.pm'		=> '$(INST_LIBDIR)/AIO.pm',
                    },
108 109 110 111
    PREREQ_PM => {
       "common::sense" => 0,
    },
    clean        => { FILES => "libeio/config.h libeio/config.log libeio/config.status" },
112 113 114 115
});

$mm->flush;