X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=bindings%2Fperl%2FMakefile.PL;h=f2ddf0ace2e6c1adf4d9dafbacb4c854760e69f1;hb=d8fc49e1b0057f77b3b8ad6403520a91e4c970b9;hp=4e375a5941ecb688e146a2bf336651dc652c7605;hpb=3929b04688e0b36669f63da10a70c53cc36d2f83;p=liboping.git diff --git a/bindings/perl/Makefile.PL b/bindings/perl/Makefile.PL index 4e375a5..f2ddf0a 100644 --- a/bindings/perl/Makefile.PL +++ b/bindings/perl/Makefile.PL @@ -1,6 +1,57 @@ use 5.008007; use ExtUtils::MakeMaker; +my @OPING_PREFIX = (qw(/opt/oping /usr /usr/local)); +my $OPING_PREFIX; + +for (my $i = 0; $i < @ARGV; $i++) +{ + if ($ARGV[$i] =~ m#^OPING_PREFIX=(.*[^/])#) + { + unshift (@OPING_PREFIX, $1); + splice (@ARGV, $i, 1); + $i--; + } +} + +for (my $i = 0; $i < @OPING_PREFIX; $i++) +{ + if (!-e $OPING_PREFIX[$i] . '/include/oping.h') + { + next; + } + + $OPING_PREFIX = $OPING_PREFIX[$i]; + print "Found in $OPING_PREFIX/include\n"; + last; +} + +if (!$OPING_PREFIX) +{ + my $search_path = join (', ', @OPING_PREFIX); + print STDERR <! * +****************************************************************************** +The header file could not be found in the usual places. The prefix +paths searched right now are: + $search_path + +Please rerun Makefile.PL giving the prefix to the oping library using the +`OPING_PREFIX' argument. If you, for example, had installed the oping library +to /tmp/oping, the header file would be at /tmp/oping/include/oping.h; you'd +then need to run the Makefile.PL as follows: + perl Makefile.PL OPING_PREFIX=/tmp/oping + +As you can see, the argument passed via `OPING_PREFIX' must be the same +directory you passed to the liboping configure script using the `--prefix' +argument. + +No Makefile has been created. +EOF + exit (0); +} + WriteMakefile( NAME => 'Net::Oping', VERSION_FROM => 'lib/Net/Oping.pm', @@ -9,7 +60,7 @@ WriteMakefile( ? (ABSTRACT_FROM => 'lib/Net/Oping.pm', AUTHOR => 'Florian Forster ') : ()), - LIBS => ['-loping', '-L/opt/oping/lib/ -loping'], + LIBS => ["-L$OPING_PREFIX/lib -loping"], DEFINE => '', - INC => '-I/opt/oping/include/' + INC => "-I$OPING_PREFIX/include" );