2 use ExtUtils::MakeMaker;
5 my @OPING_PREFIX = (qw(/opt/oping /usr /usr/local));
13 # TOP_BUILDDIR is set by liboping's build system, so Net::Oping can link with
14 # the yet uninstalled library.
18 # Parse custom command line arguments.
19 for (my $i = 0; $i < @ARGV; $i++)
21 if ($ARGV[$i] =~ m#^OPING_PREFIX=(.*[^/])#)
23 unshift (@OPING_PREFIX, $1);
24 splice (@ARGV, $i, 1);
27 elsif ($ARGV[$i] =~ m#^TOP_BUILDDIR=(.*[^/])#)
30 # TOP_BUILDDIR is passed from bindings/, but we're currently in
31 # bindings/perl/. If it is a relative path, we need to add an
32 # extra `../' in order to compensate for this.
33 if ($TOP_BUILDDIR !~ m#^/#)
35 $TOP_BUILDDIR = "../$TOP_BUILDDIR";
37 splice (@ARGV, $i, 1);
40 elsif ($ARGV[$i] =~ m#^TARGET_LIBDIR=(.*[^/])#)
42 # Only save TARGET_LIBDIR if it's not a standard system library
43 # directory, such as /usr/lib.
44 if (!is_system_libdir ($1))
48 splice (@ARGV, $i, 1);
55 for (my $i = 0; $i < @OPING_PREFIX; $i++)
57 if (!-e $OPING_PREFIX[$i] . '/include/oping.h')
62 $OPING_PREFIX = $OPING_PREFIX[$i];
63 print "Found <oping.h> in $OPING_PREFIX/include\n";
70 # Use LDDLFLAGS here instead of LIBS, because:
71 # 1) We need to make sure our library path comes first (and no locally
72 # installed version is used).
73 # 2) Prevent MakeMaker from stipping the -rpath option when the
74 # library is to be installed in a non-standard path. Standard-paths
75 # are read from $Config{'libsdirs'} above.
76 $OPING_CPPFLAGS = "-I$TOP_BUILDDIR/src";
77 $OPING_LDDLFLAGS = "-L$TOP_BUILDDIR/src/.libs " . $Config{'lddlflags'};
78 $OPING_LIBS = "-L$TOP_BUILDDIR/src/.libs -loping";
82 $OPING_LDDLFLAGS .= qq( -Wl,-rpath -Wl,"$TARGET_LIBDIR");
85 $OPING_DEPEND = { 'Oping.o' => "$TOP_BUILDDIR/src/liboping.la" };
89 # -rpath is automagically set in this case.
90 $OPING_CPPFLAGS = "-I$OPING_PREFIX/include";
91 $OPING_LIBS = "-L$OPING_PREFIX/lib -loping";
96 my $search_path = join (', ', @OPING_PREFIX);
98 ******************************************************************************
99 * ERROR: COULD NOT FIND THE NEEDED HEADER FILE <oping.h>! *
100 ******************************************************************************
101 The <oping.h> header file could not be found in the usual places. The prefix
102 paths searched right now are:
105 Please rerun Makefile.PL giving the prefix to the oping library using the
106 `OPING_PREFIX' argument. If you, for example, had installed the oping library
107 to /tmp/oping, the header file would be at /tmp/oping/include/oping.h; you'd
108 then need to run the Makefile.PL as follows:
109 perl Makefile.PL OPING_PREFIX=/tmp/oping
111 As you can see, the argument passed via `OPING_PREFIX' must be the same
112 directory you passed to the liboping configure script using the `--prefix'
115 No Makefile has been created.
121 NAME => 'Net::Oping',
122 VERSION_FROM => 'lib/Net/Oping.pm',
125 ? (ABSTRACT_FROM => 'lib/Net/Oping.pm',
126 AUTHOR => 'Florian Forster <octo@verplant.org>')
128 ($OPING_DEPEND ? (depend => $OPING_DEPEND) : ()),
129 LIBS => [$OPING_LIBS],
130 ($OPING_LDDLFLAGS ? (LDDLFLAGS => "$OPING_LDDLFLAGS") : ()),
132 INC => "$OPING_CPPFLAGS"
138 for (split (' ', $Config{'libsdirs'}))