Index: RRDTool-OO-0.32/Makefile.PL
--- RRDTool-OO-0.32/Makefile.PL.orig	2010-06-26 05:32:42.000000000 +0200
+++ RRDTool-OO-0.32/Makefile.PL	2012-03-08 10:57:56.000000000 +0100
@@ -10,52 +10,12 @@
     }
 };
 
-# Check if RRDs is installed
-
-eval "use RRDs 1.2011";
-
-    # (1) libcgi is missing on most Linux/FreeBSD systems, and we
-    #     don't need it anyway.
-    # (2) as of rrdtool-1.2.11, tcl libs didn't compile, so let's
-    #     leave them out.
-my $CONFIGURE_OPTS = "--enable-perl-site-install --prefix=/usr --disable-tcl --disable-rrdcgi";
-
-my $DIST_URL = 
-"http://oss.oetiker.ch/rrdtool/pub/rrdtool.tar.gz";
-
-if($@) {
-    print <<EOT;
-This module requires rrdtool 1.2.x and the RRDs module to be 
-installed. They are available in the rrdtool distribution:
- $DIST_URL
-EOT
-
-    $| = 1;
-    my $in = prompt ("Do you want me to install it for you right now (y/n)?","n");
-    chomp $in;
-    if($in =~ /^\s*$/ or $in =~ /y/i) {
-        if($> != 0) {
-            die "\nYou need to be root to do this.\n";
-        }
-        eval { install_RRDs() };
-        if($@) {
-            print $@;
-            note();
-            exit 0;
-        }
-    } else {
-        note();
-        exit 0;
-    }
-}
-
 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
 # the contents of the Makefile that is written.
 WriteMakefile(
     NAME              => 'RRDTool::OO',
     VERSION_FROM      => 'lib/RRDTool/OO.pm', # finds $VERSION
     PREREQ_PM         => {
-                         Log::Log4perl => '0.40',
                          RRDs          => 0,
                          }, # e.g., Module::Name => 1.1
     $ExtUtils::MakeMaker::VERSION >= 6.50 ? (%$meta_merge) : (),
Index: RRDTool-OO-0.32/lib/RRDTool/OO.pm
--- RRDTool-OO-0.32/lib/RRDTool/OO.pm.orig	2012-03-07 17:29:01.000000000 +0100
+++ RRDTool-OO-0.32/lib/RRDTool/OO.pm	2012-03-08 21:30:51.000000000 +0100
@@ -6,7 +6,6 @@
 use Carp;
 use RRDs;
 use Data::Dumper;
-use Log::Log4perl qw(:easy);
 
 our $VERSION = '0.32';
 
@@ -203,7 +202,7 @@
         # Check if we got all mandatory parameters
     for(@{$ref->{mandatory}}) {
         if(! exists $options_hash{$_}) {
-            Log::Log4perl->get_logger("")->logcroak(
+            croak(
                 "Mandatory parameter '$_' not set " .
                 "in $method() (@{[%mandatory]}) (@$options)");
         }
@@ -215,7 +214,7 @@
         for(keys %options_hash) {
             if(! exists $optional{$_} and
                ! exists $mandatory{$_}) {
-                Log::Log4perl->get_logger("")->logcroak(
+               croak(
                     "Illegal parameter '$_' in $method()");
             }
         }
Index: bindings/perl-shared/Makefile.PL
--- bindings/perl-shared/Makefile.PL.orig	2011-12-15 17:07:05.000000000 +0100
+++ bindings/perl-shared/Makefile.PL	2012-03-08 10:57:56.000000000 +0100
@@ -20,32 +20,7 @@
 		) : ()
 	);
 }else{
-	# if the last argument when calling Makefile.PL is RPATH=/... and ... is the
-	# path to librrd.so then the Makefile will be written such that RRDs.so knows
-	# where to find librrd.so later on ... 
-	my $R="";
-	if ($ARGV[-1] =~ /RPATH=(\S+)/){
-		pop @ARGV;
-		my $rp = $1;
-		for ($^O){
-			/linux/   && do{ $R = "-Wl,--rpath -Wl,$rp"};
-			/hpux/    && do{ $R = "+b$rp"};
-			/solaris/ && do{ $R = "-R$rp"};
-			/bsd/     && do{ $R = "-R$rp"};
-			/aix/     && do{ $R = "-blibpath:$rp"};
-		}
-	}
-
-	# 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;
-	if ($^O eq 'darwin'){
-        $librrd = '-lrrd';
-	} else {
-		$librrd = "-L../../src/.libs/ $R -lrrd";
-	}
+    my $librrd = "-L../../src/.libs/ -lrrd -L$Config{prefix}/lib -lcairo -lpangocairo -lpixman-1 -lpango -lpangoft2 -lfreetype -lpng -lgobject2 -lgio2 -lgmodule2 -lglib2 -lfontconfig -lfreetype -lxml2 -lexpat -lpcre -lz -liconv -lintl";
 
 	WriteMakefile(
 		'NAME'         => 'RRDs',
Index: bindings/python/setup.py
--- bindings/python/setup.py.orig	2008-03-15 11:39:48.000000000 +0100
+++ bindings/python/setup.py	2012-03-08 10:57:56.000000000 +0100
@@ -47,7 +47,7 @@
           Extension(
             "rrdtoolmodule",
             ["rrdtoolmodule.c"],
-            libraries=['rrd'],
+            libraries=['rrd', 'freetype', 'art_lgpl', 'png', 'z'],
             library_dirs=[library_dir],
             include_dirs=[include_dir],
           )
Index: configure
--- configure.orig	2012-01-24 11:09:06.000000000 +0100
+++ configure	2012-03-08 10:57:56.000000000 +0100
@@ -25560,7 +25560,7 @@
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpangocairo-1.0  $LIBS"
+LIBS="-lpangocairo  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -25749,7 +25749,7 @@
 
 fi
 if test "x$ac_cv_header_pango_pango_h" = x""yes; then
-  LIBS="-lpangocairo-1.0 ${LIBS}";EX_CHECK_STATE=YES
+  LIBS="-lpangocairo ${LIBS}";EX_CHECK_STATE=YES
 fi
 
 
@@ -25812,7 +25812,7 @@
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpangocairo-1.0  $LIBS"
+LIBS="-lpangocairo  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -26100,13 +26100,13 @@
  if test "x""" != "x"; then
    CPPFLAGS="$CPPFLAGS -I"""
  fi
-  { $as_echo "$as_me:$LINENO: checking for glib_check_version in -lglib-2.0" >&5
-$as_echo_n "checking for glib_check_version in -lglib-2.0... " >&6; }
+  { $as_echo "$as_me:$LINENO: checking for glib_check_version in -lglib2" >&5
+$as_echo_n "checking for glib_check_version in -lglib2... " >&6; }
 if test "${ac_cv_lib_glib_2_0_glib_check_version+set}" = set; then
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lglib-2.0  $LIBS"
+LIBS="-lglib2  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -26295,7 +26295,7 @@
 
 fi
 if test "x$ac_cv_header_glib_h" = x""yes; then
-  LIBS="-lglib-2.0 ${LIBS}";EX_CHECK_STATE=YES
+  LIBS="-lglib2 ${LIBS}";EX_CHECK_STATE=YES
 fi
 
 
@@ -26358,7 +26358,7 @@
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lglib-2.0  $LIBS"
+LIBS="-lglib2  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -29709,9 +29709,9 @@
 $as_echo_n "checking for headers required to compile python extensions... " >&6; }
 py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
 py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
-PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION} -I${py_prefix}/include/python"
 if test "$py_prefix" != "$py_exec_prefix"; then
-  PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+  PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION} -I${py_exec_prefix}/include/python"
 fi
 
 save_CPPFLAGS="$CPPFLAGS"
Index: src/rrd_daemon.c
--- src/rrd_daemon.c.orig	2011-12-16 08:29:44.000000000 +0100
+++ src/rrd_daemon.c	2012-03-08 10:57:56.000000000 +0100
@@ -105,7 +105,7 @@
 #include <tcpd.h>
 #endif /* HAVE_LIBWRAP */
 
-#include <glib-2.0/glib.h>
+#include <glib2/glib.h>
 /* }}} */
 
 #define RRDD_LOG(severity, ...) \
Index: src/rrd_open.c
--- src/rrd_open.c.orig	2012-01-24 11:08:48.000000000 +0100
+++ src/rrd_open.c	2012-03-08 10:57:56.000000000 +0100
@@ -296,7 +296,7 @@
 #endif
     if (rdwr & RRD_CREAT)
         goto out_done;
-#ifdef USE_MADVISE
+#if defined(USE_MADVISE) && defined(MADV_WILLNEED) && defined(MADV_SEQUENTIAL) && defined(MADV_RANDOM)
     if (rdwr & RRD_COPY) {
         /* We will read everything in a moment (copying) */
         madvise(data, rrd_file->file_len, MADV_WILLNEED );
@@ -331,7 +331,7 @@
                       rrd->stat_head->version);
         goto out_nullify_head;
     }
-#if defined USE_MADVISE
+#if defined(USE_MADVISE) && defined(MADV_WILLNEED)
     /* the ds_def will be needed soonish, so hint accordingly */
     madvise(data + PAGE_START(offset),
             sizeof(ds_def_t) * rrd->stat_head->ds_cnt, MADV_WILLNEED);
@@ -339,7 +339,7 @@
     __rrd_read(rrd->ds_def, ds_def_t,
                rrd->stat_head->ds_cnt);
 
-#if defined USE_MADVISE
+#if defined(USE_MADVISE) && defined(MADV_WILLNEED)
     /* the rra_def will be needed soonish, so hint accordingly */
     madvise(data + PAGE_START(offset),
             sizeof(rra_def_t) * rrd->stat_head->rra_cnt, MADV_WILLNEED);
@@ -354,7 +354,7 @@
             rrd_set_error("live_head_t malloc");
             goto out_close;
         }
-#if defined USE_MADVISE
+#if defined(USE_MADVISE) && defined(MADV_WILLNEED)
         /* the live_head will be needed soonish, so hint accordingly */
         madvise(data + PAGE_START(offset), sizeof(time_t), MADV_WILLNEED);
 #endif
@@ -364,7 +364,7 @@
         rrd->live_head->last_up = *rrd->legacy_last_up;
         rrd->live_head->last_up_usec = 0;
     } else {
-#if defined USE_MADVISE
+#if defined(USE_MADVISE) && defined(MADV_WILLNEED)
         /* the live_head will be needed soonish, so hint accordingly */
         madvise(data + PAGE_START(offset),
                 sizeof(live_head_t), MADV_WILLNEED);
@@ -535,7 +535,7 @@
                        + rrd->rra_ptr[i].cur_row
                        * rrd->stat_head->ds_cnt * sizeof(rrd_value_t));
         if (active_block > dontneed_start) {
-#ifdef USE_MADVISE
+#if defined(USE_MADVISE) && defined(MADV_DONTNEED)
             madvise(rrd_simple_file->file_start + dontneed_start,
                     active_block - dontneed_start - 1, MADV_DONTNEED);
 #endif
@@ -560,7 +560,7 @@
     }
 
     if (dontneed_start < rrd_file->file_len) {
-#ifdef USE_MADVISE
+#if defined(USE_MADVISE) && defined(MADV_DONTNEED)
 	    madvise(rrd_simple_file->file_start + dontneed_start,
 		    rrd_file->file_len - dontneed_start, MADV_DONTNEED);
 #endif
