File: Makefile.PL

package info (click to toggle)
libpg-perl 1%3A2.0.2-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 144 kB
  • ctags: 36
  • sloc: perl: 573; ansic: 113; makefile: 52
file content (62 lines) | stat: -rw-r--r-- 1,728 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

# $Id: Makefile.PL,v 1.1.1.1 2004/01/16 21:58:24 mpitt Exp $

use ExtUtils::MakeMaker;
use Config;
use strict;

my $OBJ_EXT=".o";
my $MAN3EXT=".3";

print "Configuring Pg\n";
print "Remember to actually read the README file !\n";

my $POSTGRES_INCLUDE;
my $POSTGRES_LIB;

if ((!$ENV{POSTGRES_INCLUDE} or !$ENV{POSTGRES_LIB}) and !$ENV{POSTGRES_HOME}) {
#    die "please set environment variables POSTGRES_INCLUDE and POSTGRES_LIB !\n";
    require App::Info::RDBMS::PostgreSQL;
    require App::Info::Handler::Prompt;
    my $p = App::Info::Handler::Prompt->new;
    my $pg = App::Info::RDBMS::PostgreSQL->new(on_unknown => $p, on_confirm => $p);
    $POSTGRES_INCLUDE = $pg->inc_dir;
    $POSTGRES_LIB     = $pg->lib_dir;
} elsif ((!$ENV{POSTGRES_INCLUDE} or !$ENV{POSTGRES_LIB}) and $ENV{POSTGRES_HOME}) {
    $POSTGRES_INCLUDE = "$ENV{POSTGRES_HOME}/include";
    $POSTGRES_LIB     = "$ENV{POSTGRES_HOME}/lib";
} else {
    $POSTGRES_INCLUDE = "$ENV{POSTGRES_INCLUDE}";
    $POSTGRES_LIB     = "$ENV{POSTGRES_LIB}";
}

my $os = $^O;
print "OS: $os\n";

my %opts = (
    NAME         => 'Pg',
    VERSION_FROM => "Pg.pm",
    INC          => "-I$POSTGRES_INCLUDE",
    OBJECT       => "Pg\$(OBJ_EXT)",
    LIBS         => ["-L$POSTGRES_LIB -lpq"],
    AUTHOR       => 'http://gborg.postgresql.org/project/pgperl/projdisplay.php',
    ABSTRACT     => 'PostgreSQL database native Perl driver',
);

if ($os eq 'hpux') {
    my $osvers = $Config{osvers};
    if ($osvers < 10) {
        print "Warning: Forced to build static not dynamic on $os $osvers.\a\n";
        $opts{LINKTYPE} = 'static';
    }
}

if ($Config{dlsrc} =~ /dl_none/) {
    $opts{LINKTYPE} = 'static';
}

WriteMakefile(%opts);

exit(0);

# end of Makefile.PL