use mount_fusefs on FreeBSD to get fuse version
[perl-fuse.git] / Makefile.PL
1 use ExtUtils::MakeMaker;
2 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
3 # the contents of the Makefile that is written.
4
5 my $ver = `fusermount -V`;
6 my $ver2 = `mount_fusefs -V`;
7 $ver =~ s/^.*?version:\s+//;
8 $ver2 =~ s/^.*?version:\s+//;
9 if ($ver && $ver + 0 < 2.5) {
10         die "Fuse perl bindings need Linux fuse version 2.5 or never\n";
11 } elsif ($ver2 && $ver2 + 0 < 0.3) {
12         die "Fuse perl bindings need FreeBSD fuse version 0.3 or never\n";
13 } else {
14         warn "fuse version found: ", $ver || $ver2, "\n";
15 }
16
17 my $inc = '-DFUSE_USE_VERSION=25 ' . `pkg-config --cflags fuse` || '-I ../include -D_FILE_OFFSET_BITS=64';
18 my $obj = `pkg-config --libs fuse` || '-lfuse';
19
20 WriteMakefile(
21         'NAME'                  => 'Fuse',
22         'VERSION_FROM'  => 'Fuse.pm', # finds $VERSION
23         'PREREQ_PM'             => {}, # e.g., Module::Name => 1.1
24         ($] >= 5.005 ?  ## Add these new keywords supported since 5.005
25                 (ABSTRACT_FROM  => 'Fuse.pm', # retrieve abstract from module
26                 AUTHOR                  => 'Mark Glines <mark@glines.org>') : ()),
27         'LIBS'                  => [''], # e.g., '-lm'
28         'DEFINE'                => '-Wall -g -ggdb', # e.g., '-DHAVE_SOMETHING'
29         # Insert -I. if you add *.h files later:
30         'INC'                   => $inc, # e.g., '-I/usr/include/other'
31         # Un-comment this if you add C files to link with later:
32         'OBJECT'                => "$obj Fuse.o -lpthread", # link all the C files too
33 );
34
35 sub MY::postamble {
36         return <<'MAKE_MORE';
37
38 sf:
39         svn2cvs.pl file:///home/dpavlin/.svk/fuse/perl-llin :ext:dpavlin@cvs.sourceforge.net:/cvsroot/fuse perl
40
41 MAKE_MORE
42 };