The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
# -*- perl -*-

# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
use strict;

use ExtUtils::MakeMaker;

my $useXS = 1;

foreach (@ARGV) {
    /^--use-xs$/ && do {
	$useXS = 1;
	next;
    };

    /^--no-xs$/ && do {
	$useXS = 0;
	next;
    };

    warn "WARNING: Option $_ was not recognized. (ignoring)\n";
}

my %BuildOptions;
$BuildOptions{'NAME'}         = "Text::Soundex";
$BuildOptions{'VERSION_FROM'} = "Soundex.pm";      # Finds $VERSION
$BuildOptions{'INSTALLDIRS'}  = $] > 5.011 ? 'site' : "perl"; # Install in CORE.
$BuildOptions{'NORECURS'}     = 1;                 # No need to recurse.

$BuildOptions{'dist'}         = {
                                 'COMPRESS'    => "gzip -v9Nf",
                                 'SUFFIX'      => "gz",
                                };

$BuildOptions{'PREREQ_PM'}    = {
                                 'if'          => 0,
                                };

if ($useXS) {
    print "The XS code will be compiled.\n" if -t STDOUT;
    $BuildOptions{'XS'}   = {'Soundex.xs' => 'Soundex.c'};
    $BuildOptions{'C'}    = ['Soundex.c'];

} else {
    print "The XS code will not be compiled.\n" if -t STDOUT;
    $BuildOptions{'XS'}   = {};
    $BuildOptions{'C'}    = [];

}

WriteMakefile(%BuildOptions);