summaryrefslogtreecommitdiff
path: root/src/interfaces/perl5/Makefile.PL
blob: 134c61e8a221ea1542af15dc6367c2bcfbd2f929 (plain)
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
63
64
65
66
67
68
#-------------------------------------------------------
#
# $Id: Makefile.PL,v 1.8 1998/06/01 16:41:19 mergl Exp $
#
# Copyright (c) 1997, 1998  Edmund Mergl
#
#-------------------------------------------------------

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

# because the perl5 interface is always contained in the source tree,
# we can be sure about the location of the include files and libs.
# For development and testing we still test for POSTGRES_HOME.
#
#print "\nConfiguring Pg\n";
#print "Remember to actually read the README file !\n";
#die "\nYou didn't read the README file !\n" unless ($] >= 5.002);
#
#if (! $ENV{POSTGRES_HOME}) {
#    warn "\$POSTGRES_HOME not defined. Searching for PostgreSQL...\n";
#    foreach(qw(../../../ /usr/local/pgsql /usr/pgsql /home/pgsql /opt/pgsql /usr/local/postgres /usr/postgres /home/postgres /opt/postgres)) {
#        if (-d "$_/lib") {
#            $ENV{POSTGRES_HOME} = $_;
#            last;
#        }
#    }
#}
#
#if (-d "$ENV{POSTGRES_HOME}/lib") {
#    print "Found PostgreSQL in $ENV{POSTGRES_HOME}\n";
#} else {
#    die "Unable to determine PostgreSQL\n";
#}

my %opts;

if (! $ENV{POSTGRES_HOME}) {

    my $cwd = `pwd`;
    chop $cwd;

    %opts = (
        NAME         => 'Pg',
        VERSION_FROM => 'Pg.pm',
        INC          => "-I$cwd/../libpq -I$cwd/../../include",
        OBJECT       => "Pg\$(OBJ_EXT)",
        LIBS         => ["-L$cwd/../libpq -lpq"],
    );

} else {

    %opts = (
        NAME         => 'Pg',
        VERSION_FROM => 'Pg.pm',
        INC          => "-I$ENV{POSTGRES_HOME}/include",
        OBJECT       => "Pg\$(OBJ_EXT)",
        LIBS         => ["-L$ENV{POSTGRES_HOME}/lib -lpq"],
    );
}


WriteMakefile(%opts);

exit(0);

# end of Makefile.PL