From: Roberto Costa <rob.costa@libero.it>
To: PostgreSQL interfaces mailing list <pgsql-interfaces@postgresql.org>
Subject: Automatic detection of PostgreSQL version
Date: Mon, 10 Mar 2003 22:10:33 +0100
Message-ID: <3E6CFF49.54AF36EB@libero.it> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: rob.costa@libero.it
Subject: Re: Automatic detection of PostgreSQL version
In-Reply-To: <3E6CFF49.54AF36EB@libero.it>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox