DBD-DB2

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN


#   engn/perldb2/Makefile.PL, engn_perldb2, db2_v82fp9, 1.11 04/09/14 10:47:41
#
#   Copyright (c) 1995-2004 International Business Machines Corp.
#
#!/usr/local/bin/perl -sw

use ExtUtils::MakeMaker qw(&WriteMakefile $Verbose );
use Getopt::Std;
use Config;
#require 'flush.pl';

use DBI::DBD;        # The DBI must be installed before we can build a DBD

my %opts = (
    'NAME'         => 'DBD::DB2',
    'VERSION_FROM' => 'DB2.pm',
    ($] ge '5.005')
       ? ( 'AUTHOR' => 'DB2 Perl (db2perl@ca.ibm.com)',
           'ABSTRACT' => 'Perl driver for IBM DB2 Universal Database', )
       : (),
    ( $Config{archname} =~ /-object\b/i )
       ? ( 'CAPI' => 'TRUE', )
       : (),
    'OBJECT'       => '$(O_FILES)',
);

# --- Introduction

print "\nConfiguring DBD::DB2...\n";
print "Remember to actually read the README and CAVEATS files!\n\n";

# --- Operating system

my $os = $^O;

# --- Where is DB2 installed...

my $envvar = 'DB2_HOME';
my $DB2 = $ENV{$envvar};
if( not $DB2 )
{
  $envvar = 'DB2PATH';
  $DB2 = $ENV{$envvar};
}
if( not $DB2 )
{
  my ($pathsep, $path, @pathlist);

  $pathsep = $Config{'path_sep'};
  $pathsep = ':' unless $pathsep;

  $path = $ENV{'PATH'};
  $path =~ s:\\:/:g if $pathsep eq ';';

  @pathlist = split /$pathsep/, $path;
  foreach $path (@pathlist)
  {
    if( lc( substr( $path, -4 ) ) eq '/bin' &&
        -f "$path/../include/sqlcli.h" )
    {
      $DB2 = substr( $path, 0, -4 );
      last;
    }
  }
}
$DB2 =~ s:\\:/:g if $os eq 'MSWin32' || $os eq 'MSWin64' || $os eq 'os2';
$DB2 =~ s/"//g;
die "DB2_HOME environment variable must be set to installed location of DB2.\n"
    unless $DB2;
die "$envvar environment variable ($DB2) not valid.\n" unless -d $DB2;

print qq(Using DB2 in "$DB2"\n);

# --- Setup include paths and libraries
# $opts{INC} .= qq( -I"$DB2/include" -I"$Config{sitearchexp}/auto/DBI" );
# $opts{INC} .= qq(-I"$Config{installarchlib}/auto/DBI" ) if $Config{installarchlib};
# $opts{INC} .= qq(-I"$Config{installvendorarch}/auto/DBI" ) if $Config{installvendorarch};



( run in 1.112 second using v1.01-cache-2.11-cpan-a49fcb8fa48 )