1 use ExtUtils::MakeMaker;
2 use Config;
3 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
4 # the contents of the Makefile that is written.
6 if (($Config{'osname'} eq 'MSWin32' && $ENV{'OSTYPE'} eq '')) {
7 WriteMakefile(
8 'NAME' => 'RRDs',
9 'VERSION_FROM' => 'RRDs.pm',
10 'DEFINE' => "-DPERLPATCHLEVEL=$Config{PATCHLEVEL} -D_CRT_SECURE_NO_WARNINGS -DWIN32",
11 'INC' => '-I../../src/ "-IC:/Perl/lib/CORE" -I"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include" -I"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include"',
12 'LDDLFLAGS' => '-dll -nologo -opt:ref,icf -ltcg -libpath:"C:\Perl\lib\CORE" -machine:X86',
13 'LDFLAGS' => '-nologo -opt:ref,icf -ltcg -libpath:"C:\Perl\lib\CORE" -machine:X86',
14 'OPTIMIZE' => '-O2 -MD',
15 'LIBS' => '"..\..\win32\Release\rrdlib.lib" "..\..\win32\Release" "C:\Perl\lib\CORE\perl514.lib" -L../../contrib/lib -L"C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib" -L"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib" -L"C:\Perl\lib\CORE"',
16 'realclean' => {FILES => 't/demo?.rrd t/demo?.png' },
17 ($] ge '5.005') ? (
18 'AUTHOR' => 'Tobias Oetiker (tobi@oetiker.ch)',
19 'ABSTRACT' => 'Round Robin Database Tool',
20 ) : ()
21 );
22 }else{
23 # if the last argument when calling Makefile.PL is RPATH=/... and ... is the
24 # path to librrd.so then the Makefile will be written such that RRDs.so knows
25 # where to find librrd.so later on ...
26 my $R="";
27 if ($ARGV[-1] =~ /RPATH=(\S+)/){
28 pop @ARGV;
29 my $rp = $1;
30 for ($^O){
31 /linux/ && do{ $R = "-Wl,--rpath -Wl,$rp"};
32 /hpux/ && do{ $R = "+b$rp"};
33 /solaris/ && do{ $R = "-R$rp"};
34 /bsd/ && do{ $R = "-R$rp"};
35 /aix/ && do{ $R = "-blibpath:$rp"};
36 }
37 }
39 # darwin works without this because librrd contains its
40 # install_name which will includes the final location of the
41 # library after it is installed. This install_name gets transfered
42 # to the perl shared object.
43 my $librrd;
44 if ($^O eq 'darwin'){
45 $librrd = '-lrrd';
46 } else {
47 $librrd = "-L../../src/.libs/ $R -lrrd";
48 }
50 WriteMakefile(
51 'NAME' => 'RRDs',
52 'VERSION_FROM' => 'RRDs.pm', # finds $VERSION
53 'DEFINE' => "-DPERLPATCHLEVEL=$Config{PATCHLEVEL}",
54 'INC' => '-I../../src',
55 # Perl will figure out which one is valid
56 #'dynamic_lib' => {'OTHERLDFLAGS' => "$librrd -lm"},
57 'depend' => {'RRDs.c' => "../../src/librrd.la"},
58 'LDFROM' => '$(OBJECT) '.$librrd,
59 'realclean' => {FILES => 't/demo?.rrd t/demo?.png' },
60 ($^O eq 'darwin') ? ( 'LDDLFLAGS' => "-L../../src/.libs/ $Config{lddlflags}" ) : ()
61 );
62 }