X-Original-To: pgsql-interfaces@postgresql.org Received: from everyday.com (mail-fe80.tele2.ee [212.107.32.214]) by postgresql.org (Postfix) with SMTP id 308EB47592C for ; Mon, 10 Mar 2003 16:11:11 -0500 (EST) Received: (qmail 24524 invoked by uid 502); 10 Mar 2003 21:10:59 -0000 Received: from unknown (HELO libero.it) (213.217.169.19) by mail-fe80.tele2.ee with SMTP; 10 Mar 2003 21:10:59 -0000 Message-ID: <3E6CFF49.54AF36EB@libero.it> Date: Mon, 10 Mar 2003 22:10:33 +0100 From: Roberto Costa X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.17 i686) X-Accept-Language: it, en MIME-Version: 1.0 To: PostgreSQL interfaces mailing list Subject: Automatic detection of PostgreSQL version Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200303/23 X-Sequence-Number: 3772 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