Automatic detection of PostgreSQL version

From: Roberto Costa <rob(dot)costa(at)libero(dot)it>
To: PostgreSQL interfaces mailing list <pgsql-interfaces(at)postgresql(dot)org>
Subject: Automatic detection of PostgreSQL version
Date: 2003-03-10 21:10:33
Message-ID: 3E6CFF49.54AF36EB@libero.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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


Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Magnus Hagander 2003-03-10 21:13:37 Re: [INTERFACES] Roadmap for FE/BE protocol redesign
Previous Message Tom Lane 2003-03-10 19:52:55 Re: Roadmap for FE/BE protocol redesign