POSIX-strftime-GNU
view release on metacpan or search on metacpan
inc/Module/Build/My.pm view on Meta::CPAN
package Module::Build::My;
use 5.006;
use strict;
use warnings;
use base 'Module::Build';
use Config;
sub new {
my ($class, @args) = @_;
my $self = $class->SUPER::new(@args);
$self->config(cc => $ENV{CC}) if defined $ENV{CC};
$self->config(ld => $ENV{LD}) if defined $ENV{LD};
$self->config(lddl => $ENV{LD}) if defined $ENV{LD};
$self->extra_compiler_flags(grep { $_ ne '' } split /\s/, $ENV{CFLAGS}) if defined $ENV{CFLAGS};
$self->extra_linker_flags( grep { $_ ne '' } split /\s/, $ENV{LDFLAGS}) if defined $ENV{LDFLAGS};
return $self;
};
sub ACTION_xs_config {
my $self = shift;
return if $self->args('pp');
my $config_h = 'xs/xs_config.h';
$self->add_to_cleanup($config_h);
return if $self->up_to_date('Build', $config_h);
require ExtUtils::CChecker;
my $chk = ExtUtils::CChecker->new(
defines_to => $config_h,
);
$chk->define('HAVE_MKTIME 1') if $Config{d_mktime};
$chk->define('HAVE_TM_GMTOFF 1') if $Config{d_tm_tm_gmtoff};
$chk->define('HAVE_TM_ZONE 1') if $Config{d_tm_tm_zone};
$chk->define('HAVE_TZNAME 1') if $Config{d_tzname};
foreach my $kw (qw( __restrict __restrict__ _Restrict restrict )) {
last if $chk->try_compile_run(
define => "restrict $kw",
source => << "EOF" );
typedef int * int_ptr;
int foo (int_ptr $kw ip) {
return ip[0];
}
int
main ()
{
int s[1];
int * $kw t = s;
t[0] = 0;
return foo(t);
return 0;
}
EOF
}
$chk->try_compile_run(
define => 'HAVE_DECL_TZNAME 1',
source => << "EOF" );
#include <time.h>
int main () {
#ifndef tzname
(void) tzname;
#endif
return 0;
}
EOF
foreach my $m (qw( E O 1 )) {
$chk->try_compile_run(
define => "HAVE_STRFTIME_${m}_MODIFIER 1",
source => << "EOF" );
#include <time.h>
#include <stdio.h>
( run in 3.345 seconds using v1.01-cache-2.11-cpan-f03e8824b8d )