Audio-SndFile

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

# also also, we probably need something like this for the newer functions
# unless they're better documented than the enums :P

my $cc = "$Config{cc} $flags";
my $redir = "";
if (-e "/dev/null") {
# assume unix type redirection (not needed but makes the output a lot cleaner)
    $redir = " >/dev/null 2>&1";
}

my @not_found;
open F,">","constants.xs" or die "Can't write constants.xs: $!";
print F $boiler;
for (@Audio::SndFile::Constants::EXPORT_OK) {
    print "$_ ...";
    open C,">test.c" or die "Can't write test.c: $!";
    print C qq(
#include <sndfile.h>
#include <stdio.h>
int main() {
    printf("%d\\n",$_);

Makefile.PL  view on Meta::CPAN

int
$_()
  CODE:
  RETVAL = $_;
  OUTPUT:
  RETVAL
);
    }
    else {
        print "not found\n";
        push @not_found,$_;
    }
}
close F;
print "\n";
if (@not_found) {
    print "You are missing @not_found.\n";
    if (grep { !/^SF_FORMAT_/ } @not_found) {
        print "You are missing some expected constants.
If building this module fails, you might want to upgrade to a more 
recent version of libsndfile
";
    }
    else {
        print "Some filetypes are not supported by your version of libsndfile.
Otherwise you will probably be alright.
";
    }
}
else {
    print "Good. You've got all formats I know about\n";
}

my %nf = map { $_ => 1 } @not_found;
my (@define,@fnotfound);

print "Testing functions...\n";
my %test_functions = (
    sf_write_sync => "sf_write_sync(&sndfile);"
);
for (sort keys %test_functions) {
    print "$_...";
    open C,">test.c" or die "Can't write test.c: $!";
    print C qq{



( run in 0.408 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )