Re: How to automatically find the *right* libpq_fe.h? - Mailing list pgsql-general

From Steve Atkins
Subject Re: How to automatically find the *right* libpq_fe.h?
Date
Msg-id 4C31FBC8-6D4D-4C90-8BBC-F9A703E899BE@blighty.com
Whole thread Raw
In response to How to automatically find the *right* libpq_fe.h?  (Kynn Jones <kynnjo@gmail.com>)
Responses Re: How to automatically find the *right* libpq_fe.h?  (Martin Gainty <mgainty@hotmail.com>)
Re: How to automatically find the *right* libpq_fe.h?  (Kynn Jones <kynnjo@gmail.com>)
List pgsql-general
On Nov 3, 2009, at 10:09 AM, Kynn Jones wrote:

> I'm trying to automate an installation of a collection of Perl
> modules, which requires determining the path to the correct
> libpq_fe.h file.
>
> My original implementation of the Makefile.PL file for this
> installation set this path as the first valid path that it could
> extract from the output of the system command "locate libpq_fe.h".
>
> Not surprisingly this leads to serious problems when the path so
> "discovered" does not really correspond to the Pg server actually
> running on the machine.
>
> Is there a better way to determine the path to the correct
> libpq_fe.h for a given Pg server, short of asking the user to enter
> it by hand?  (I'm trying to make this installation automatic rather
> than interactive.)
>
> E.g. is there some way to interrogate the running server for this
> information?

There isn't really a "right" libpq-fe.h for a given server, you just
want one that's right for the machine you're installing the app on. As
an extreme case, consider what the answer would be if the database was
on a remote machine.

Rather, use the pg_config you find in the path to get the include
directory (or the compiler flags) or use App::Info::RDBMS::PostgreSQL
or as a last resort $POSTGRES_HOME.

I think DBD::Pg knows all about this already, as well as some fallback
and override techniques, so unless you're doing something non-DBI you
shouldn't have to worry about it.

Cheers,
   Steve




pgsql-general by date:

Previous
From: Kynn Jones
Date:
Subject: How to automatically find the *right* libpq_fe.h?
Next
From: Grzegorz Jaśkiewicz
Date:
Subject: Re: How to automatically find the *right* libpq_fe.h?