Cpanel-JSON-XS

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

use 5.006002;
use ExtUtils::MakeMaker;
use Config;

my $define = '';
# https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Warning-Options.html
if ($Config{gccversion} and $Config{gccversion} =~ /^(\d+\.\d+)\./) {
  my $gccver = $1;
  if ($] > 5.035004) {
    $define = '-Wall -Wextra -W';
  } elsif ($gccver >= 4.3) {
    $define = '-Wall -Werror=declaration-after-statement -Wextra -W';
  } elsif ($gccver >= 3.4) {
    $define = '-Wall -Wdeclaration-after-statement -Wextra -W';
  }

  # -Wformat does not support the Windows specific "%I64u" format
  # and will cause false warnings in compiling 'encode_sv'.
  if($define && $^O =~/MSWin32/i) { $define .= ' -Wno-format' }
}
if ($] < 5.022 && $Config{d_setlocale} && $Config{usethreads}) {
  if (-e "/usr/include/xlocale.h") {
    $define .= " -DI_XLOCALE -DHAS_USELOCALE";
  } else {
    print "probe for xlocale.h... ";
    open PROBE, "> tmp.c";
    print PROBE <<'EOT'; close(PROBE);
#include <stdio.h>
#include <xlocale.h>
int main(int argc, char** argv, char** env) {
    printf("found\n");
    uselocale((locale_t)0);
    return 0;
}
EOT
    my $exe = "tmp$Config{exe_ext}";
    my $cc_cmd = "$Config{cc} $Config{ccflags}" .
                 " -o $exe $Config{ldflags} tmp.c $Config{libs}";
    my $rc = system($cc_cmd);
    if ($rc) {
      print "not found\n";
      print "$cc_cmd\n";
    } else {
      $define .= " -DI_XLOCALE -DHAS_USELOCALE";
    }
    unlink("tmp.c", $exe, "tmp$Config{obj_ext}");
  }
}

WriteMakefile(
  dist	 => {
    PREOP	=> 'pod2text XS.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;',
    COMPRESS	=> 'gzip -9v',
    SUFFIX	=> '.gz',
  },
  EXE_FILES    => [ "bin/cpanel_json_xs" ],
  VERSION_FROM => "XS.pm",
  NAME         => "Cpanel::JSON::XS",
  CONFIGURE_REQUIRES => {
    'Config'              => 0,
    'ExtUtils::MakeMaker' => 0,
  },
  PREREQ_PM    => {
    'overload'      => 0,
    'strict'        => 0,
    'warnings'      => 0,
    'Carp'          => 0,
    'Encode'        => '1.9801',
    'Exporter'      => 0,
    'Pod::Text'     => '2.08',
    'XSLoader'      => 0,
  },
  TEST_REQUIRES => {
    'charnames'     => 0,
    'lib'           => 0,
    'utf8'          => 0,
    'B'             => 0,
    'Config'        => 0,
    'Data::Dumper'  => 0,
    'Devel::Peek'   => 0,
    'POSIX'         => 0,
    'Test'          => 0,
    'Test::More'    => 0,
    'Tie::Array'    => 0,
    'Tie::Hash'     => 0,
  },
  DEFINE       => $define,
  ($] >= 5.005 ?
   (ABSTRACT_FROM  => 'XS.pm',
    AUTHOR         => 'Reini Urban <rurban@cpan.org>',
    # ORIGINAL_AUTHOR => 'Marc Lehmann <schmorp@schmorp.de>'
   ) : ()),
  ($ExtUtils::MakeMaker::VERSION >= 6.3002 ?
   ('LICENSE'  => 'perl', ) : ()),
  ($ExtUtils::MakeMaker::VERSION gt '6.46'
   ? ('META_MERGE'  =>
    {
      'meta-spec' => {
        version => 2,
      },
      dynamic_config => 0,
      prereqs => {
        runtime => {
          requires => { # just the script, not the module
            'Encode'        => '1.9801',
          },
          recommends => {
            'Math::BigInt'   => 0,
            'Math::BigFloat' => '1.16',
          }
        },
        test => {



( run in 0.522 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )