+
+sub test_via_script {
+ my($self, $perl, $tests) = @_;
+ local $_ = $self->SUPER::test_via_script($perl, $tests);
+ s/PERL_DL_NONLAZY=1//g if $^O eq 'darwin';
+ return $_;
+}
+
+package main;
+
+chomp(my $fusever = `pkg-config --modversion fuse 2> /dev/null`);
+# Required for refuse on NetBSD
+if (!$fusever && $^O eq 'netbsd') {
+ chomp($fusever = `fusermount -V`);
+ $fusever =~ s/^.*?version:\s+//;
+}
+
+unless ($fusever) {
+ # make CPANPLUS happy and don't report errors if fuse isn't installed
+ my $explanation;
+ if ($^O eq 'linux') {
+ if (-e '/etc/debian_version') {
+ $explanation = 'You need to install "libfuse-dev" to provide build support for this module';
+ }
+ elsif (-e '/etc/redhat-release') {
+ $explanation = 'You need to install "fuse-devel" to provide build support for this module';
+ }
+ else {
+ $explanation = 'I don\'t know your Linux distribution, but please install the FUSE libraries and headers to build this module';
+ }
+ }
+ elsif ($^O eq 'freebsd') {
+ $explanation = 'You need to install the "fusefs-libs" package from ports to support this module';
+ }
+ elsif ($^O eq 'netbsd') {
+ $explanation = 'Could not find librefuse? Maybe install "perfuse" from pkgsrc, or upgrade to newer NetBSD';
+ }
+ elsif ($^O eq 'darwin') {
+ $explanation = 'Please install OSXFUSE from http://osxfuse.github.com/';
+ }
+ else {
+ $explanation = 'There is no FUSE support for your platform to our knowledge, sorry';
+ }
+ die("Cannot build for platform: $^O\n", $explanation, "\n");
+}
+if ($fusever && $fusever + 0 < 2.6) {
+ die "FUSE API is ", $fusever, ", must be 2.6 or later\n";