Audio-SndFile
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
# Audio::SndFile - perl glue to libsndfile
#
# Copyright (C) 2006 by Joost Diepenmaat, Zeekat Softwareontwikkeling
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
use 5.006;
use strict;
use warnings;
use ExtUtils::MakeMaker;
use Config;
$|=1;
print "Testing for pkg-config...\n";
system("pkg-config --version") and die "You don't have pkg-config installed.
You can get pkg-config at http://pkgconfig.freedesktop.org/wiki/
";
print "Testing for sndfile via pkg-config...";
system("pkg-config sndfile") and die "
Can't find sndfile development files not installed.
Please make sure you've installed libsndfile and libsndfile-dev
Recent linux distributions should have them as packages. Otherwise,
you can find libsndfile at http://www.mega-nerd.com/libsndfile/
";
print "ok\n";
my $sndversion = `pkg-config --modversion sndfile`;
my ($major,$medium,$minor) = split /\./,$sndversion;
die "This module is made for libsndfile versions 1.X.X. You have $sndversion\n" if ($major != 1);
chomp(my $flags = `pkg-config --cflags --libs sndfile`);
chomp(my $inc = `pkg-config --cflags sndfile`);
chomp(my $libs = `pkg-config --libs sndfile`);
warn "According to pkg-config, LIBS should be '$libs' and INC should be '$inc'\n";
BEGIN {
require 'lib/Audio/SndFile/Constants.pm';
}
my $boiler = <<BOILER;
##########################################################################
# This file is generated by Makefile.PL and should not be edited by hand #
##########################################################################
BOILER
print "Testing for enums\n";
# note: you cannot test for enums using the preprocessor, so
# create a short program for each enum we know about and see if
# it compiles. this might fail if $Config{cc} needs any additional
# flags besides the ones from pkg-config to build and link an executable.
# also, it's pretty slow
# 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: $!";
( run in 0.483 second using v1.01-cache-2.11-cpan-df04353d9ac )