use strict;
use warnings;

use Config qw(%Config);

# Unicode support is enabled by default on Windows and disabled on Unix.
# On Unix Unicode support also requires unixODBC and doesn't work with iODBC.
# unixODBC is GPL only, so it cannot be used for binaries bundled with AP.

# Disable Unicode support for APED 5.8
if (defined($ENV{AS_PERL_PRODUCT}) &&
    $ENV{AS_PERL_PRODUCT} =~ /^ActivePerl(EE| Enterprise)/)
{
    push(@ARGV, "--nou") if $] < 5.010;
}

# We are using iODBC for all Unix builds
unless ($^O eq "MSWin32") {
    push(@ARGV, "-o", "../iodbc");
    # DBD-ODBC/Makefile.PL locates iodbc-config via PATH
    $ENV{PATH} = "../iodbc/bin:$ENV{PATH}";
    # print out iodbc prefix for debugging
    system("grep ^prefix ../iodbc/bin/iodbc-config");
}

# We patch Makefile.PL to set PL_FILES to avoid running AS-Makefile.PL twice
system("$Config{perlpath} Makefile.PL @ARGV");
