Re: Automatic detection of PostgreSQL version - Mailing list pgsql-interfaces

From Peter Eisentraut
Subject Re: Automatic detection of PostgreSQL version
Date
Msg-id Pine.LNX.4.44.0303120121460.1617-100000@peter.localdomain
Whole thread Raw
In response to Automatic detection of PostgreSQL version  (Roberto Costa <rob.costa@libero.it>)
Responses Re: Automatic detection of PostgreSQL version
List pgsql-interfaces
Roberto Costa writes:

> What I'm currently doing is searching typical include directories (like
> /usr/include, /usr/local/share/include, ...) for the presence of a
> directory named postgresql or pgsql that contains config.h or
> pg_config.h (used since PostgreSQL 7.2, if I'm not wrong). When such a
> file is found, I grep it for a line that starts with "#define
> PG_VERSION" and I expect the version follow and be in the form "x.y.z".
> This works for the latest PostgreSQL versions that I could test,
> however I don't know whether this check may work with earlier ones. In
> reality I even ignore if this kind of check is the best way to get what
> I want.

All of that seems highly unusual.  configure scripts are supposed to check
for alternative features in libraries, not search the entire file system
for the "best" library.  I suggest you just include the libpq++ header
file in your code and be done with it.  If it's missing the user will get
an error from the compiler and will know what to do.  (Possibly there will
be some documentation to help him, too.)  Users that have multiple
versions installed can select the one to use with the usual CPPFLAGS and
LDFLAGS variables.

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-interfaces by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: permanently setting PROMPT1
Next
From: Peter Eisentraut
Date:
Subject: Re: Postgres Scaling