+ elsif ($ARGV[$i] =~ m#^TOP_BUILDDIR=(.*[^/])#)
+ {
+ $TOP_BUILDDIR = $1;
+ # TOP_BUILDDIR is passed from bindings/, but we're currently in
+ # bindings/perl/. If it is a relative path, we need to add an
+ # extra `../' in order to compensate for this.
+ if ($TOP_BUILDDIR !~ m#^/#)
+ {
+ $TOP_BUILDDIR = "../$TOP_BUILDDIR";
+ }
+ splice (@ARGV, $i, 1);
+ $i--;
+ }
+ elsif ($ARGV[$i] =~ m#^TARGET_LIBDIR=(.*[^/])#)
+ {
+ # Only save TARGET_LIBDIR if it's not a standard system library
+ # directory, such as /usr/lib.
+ if (!is_system_libdir ($1))
+ {
+ $TARGET_LIBDIR = $1;
+ }
+ splice (@ARGV, $i, 1);
+ $i--;
+ }
+}
+
+if (!$TOP_BUILDDIR)
+{
+ for (my $i = 0; $i < @OPING_PREFIX; $i++)
+ {
+ if (!-e $OPING_PREFIX[$i] . '/include/oping.h')
+ {
+ next;
+ }
+
+ $OPING_PREFIX = $OPING_PREFIX[$i];
+ print "Found <oping.h> in $OPING_PREFIX/include\n";
+ last;
+ }