# This Makefile.PL for IP-Geolocation-MMDB was generated by
# Dist::Zilla::Plugin::MakeMaker::Awesome 0.49.
# Don't edit it but the dist.ini and plugins used to construct it.

use strict;
use warnings;

use 5.016;
use ExtUtils::MakeMaker;

use Config;
my @defines;
my $byteorder = $Config{byteorder};
if (!defined $byteorder) {
 warn "\$Config{byteorder} is undefined.\n";
 die "OS unsupported\n";
}
if ($byteorder == 4321 || $byteorder == 87654321) {
 push @defines, '-DWORDS_BIGENDIAN';
}
elsif (!($byteorder == 1234 || $byteorder == 12345678)) {
 warn "Unknown byte order: $byteorder\n";
 die "OS unsupported\n";
}

my %WriteMakefileArgs = (
  "ABSTRACT" => "Read MaxMind DB files",
  "AUTHOR" => "Andreas V\x{f6}gele <voegelas\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "Alien::libmaxminddb" => 0,
    "ExtUtils::MakeMaker" => 0,
    "Math::BigInt" => "1.999806"
  },
  "DISTNAME" => "IP-Geolocation-MMDB",
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.016",
  "NAME" => "IP::Geolocation::MMDB",
  "PREREQ_PM" => {
    "Math::BigInt" => "1.999806",
    "XSLoader" => 0,
    "utf8" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {
    "Alien::libmaxminddb" => 0,
    "File::Spec::Functions" => 0,
    "Test::More" => 0
  },
  "VERSION" => "1.010",
  "test" => {
    "TESTS" => "t/*.t"
  }
);

%WriteMakefileArgs = (
    %WriteMakefileArgs,
    CCFLAGS => Alien::libmaxminddb->cflags . ' ' . $Config{ccflags},
    LIBS => [ Alien::libmaxminddb->libs ],
    DEFINE => join(q{ }, @defines),
);

my %FallbackPrereqs = (
  "Alien::libmaxminddb" => 0,
  "File::Spec::Functions" => 0,
  "Math::BigInt" => "1.999806",
  "Test::More" => 0,
  "XSLoader" => 0,
  "utf8" => 0,
  "warnings" => 0
);

unless ( eval { ExtUtils::MakeMaker->VERSION('6.63_03') } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};
  delete $WriteMakefileArgs{BUILD_REQUIRES};
  $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}

delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };

WriteMakefile(%WriteMakefileArgs);

# Alien::Base->atleast_version might not be available.
use Alien::libmaxminddb;
my $version = Alien::libmaxminddb->version;
if ($version =~ m{^(0|1\.[01])\.}) {
  warn "Error: libmaxminddb $version is too old.\n";
  die "OS unsupported\n";
}
# Some Math::BigInt versions fail on i386 if Perl is built with -Dusequadmath.
use Math::BigInt;
if (!eval { Math::BigInt->from_bytes(pack 'C6', 0xff, 0xff, 0xb0, 0x09, 0x00, 0x00)->as_hex eq '0xffffb0090000' }) {
  warn "Error: Math::BigInt is too old or broken.\n";
  die "OS unsupported\n";
}