Automatic detection of PostgreSQL version - Mailing list pgsql-interfaces

From Roberto Costa
Subject Automatic detection of PostgreSQL version
Date
Msg-id 3E6CFF49.54AF36EB@libero.it
Whole thread Raw
Responses Re: Automatic detection of PostgreSQL version  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Automatic detection of PostgreSQL version  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-interfaces
Hello,
I'm starting an open-source project, which will include a client to
access a PostgreSQL database through libpq++ library. I'm quite new to
PostgreSQL and I haven't followed its development, this is why I hope to
find some information I need here!

For the configure.ac file of the above mentioned project, I would like
to use an autoconf macro to detect the location of PostgreSQL's include
directory eventually installed on the system and, if more than one are
found, to select the most recent (by default).
I looked over the internet to see whether such a macro is already
available somewhere, I couldn't find it and I began writing my own one.

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.

What do you think about that? Do you know where I could find the
information I'm looking for?
Any suggestion, comment or remark is more than welcome!

Cheers,
Roberto




pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: Roadmap for FE/BE protocol redesign
Next
From: "Magnus Hagander"
Date:
Subject: Re: Roadmap for FE/BE protocol redesign