make the bindings work on os x
[rrdtool.git] / bindings / perl-shared / Makefile.PL
index 2f2618e..75834ec 100644 (file)
@@ -4,17 +4,28 @@ use Config;
 # the contents of the Makefile that is written.
 
 # Specify the location of the archive containing PIC compiled object files.
-my $R = $^O eq 'Linux' ? "-Wl,--rpath -Wl," : "-R" ;
-my $librrd = "-L../../src/.libs/ $R\$(RPATH) -lrrd";
+my $R = "";
+
+
+for ($^O){
+        /linux/   && do{ $R = "-Wl,--rpath -Wl,\$(RPATH)"};
+        /hpux/    && do{ $R = "+b\$(RPATH)"};
+        /solaris/ && do{ $R = "-R\$(RPATH)"};
+}
+
+# darwin works without this because librrd contains its
+# install_name which will includes the final location of the
+# library after it is installed. This install_name gets transfered
+# to the perl shared object.
+
+my $librrd = "-L../../src/.libs/ $R -lrrd";
 
 WriteMakefile(
     'NAME'         => 'RRDs',
     'VERSION_FROM' => 'RRDs.pm', # finds $VERSION
     'DEFINE'      => "-DPERLPATCHLEVEL=$Config{PATCHLEVEL}",
     'INC'          => '-I../../src',
-    # where to look for the necessary libraries 
     # Perl will figure out which one is valid
-    'depend'      => {'RRDs.c' => "../../src/.libs/librrd.so"},
     'dynamic_lib'  => {'OTHERLDFLAGS' => "$librrd -lm"},
     'realclean'    => {FILES => 't/demo?.rrd t/demo?.png' }
 );