[GRASS5] postgresql.m4 autoconf feature macro test

Eric G . Miller egm2 at jps.net
Sat Sep 16 03:37:56 EDT 2000


Here's a follow-up.  I made said changes to my set-up, and it seems to
work.  However, when I re-ran autoconf, it didn't like the
AC_BINDIR_DEFAULT(/usr/local/bin) in configure.in.  Commenting it out 
makes no difference since BINDIR=/usr/local/bin is defined later.

So, if anyone want's to test this on their set-up:
1. Copy the lines below between <postgresql.m4></postgresql.m4> to
   a file called aclocal.m4 at the top of the grass tree.
2. Apply this diff to Makefile.in and configure.in:

Index: Makefile.in
===================================================================
RCS file: /home/grass/grassrepository/grass/Makefile.in,v
retrieving revision 1.22
diff -r1.22 Makefile.in
14a15,17
> PQLIB=                  @PQLIB@
> PQINCPATH=              @PQINCPATH@
> 
Index: configure.in
===================================================================
RCS file: /home/grass/grassrepository/grass/configure.in,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 configure.in
3c3
< AC_BINDIR_DEFAULT(/usr/local/bin)
---
> dnl AC_BINDIR_DEFAULT(/usr/local/bin)
241a242
> POSTGRESQL_CHECKS

3. Run autoconf
4. ./configure

Note: None of the Postgresql modules use these variables yet and the
a decision needs to be made about enabling/disabling postgresql modules.

Q. Should there be a --enable-postgres flag?
	If so, the m4 macro should have failure points changed from exit
	0 to exit 1 (so configure fails).
OR

Q. Should postgresql support be automatic if the variables are defined?

Does this matter to anyone?

I suppose I could request CVS write access.  Bernard?

On Thu, Sep 14, 2000 at 11:29:32PM -0700, Eric G . Miller wrote:
> Here's a little PostgreSQL feature macro.  I appended it to an
> aclocal.m4 in a test config env, and added these to Makefile.am:
> 
> PQINCPATH = @PQINCPATH@
> PQLIB = @PQLIB@
> 
> Since GRASS currently doesn't use those, the subst variables can be put
> in Makefile.in, and I suppose the macro can be added in aclocal.m4 at
> the top directory. It's real simple and assumes libpq is in the default
> search path.  ./config options could be added.  configure.in will need
> POSTGRESQL_CHECKS on a line somewhere.  Anyway, it should work for most
> standard configurations.
> 
> <postgresql.m4>
> # Checks for libpq and libpq-fe.h, sets variables if found.
> AC_DEFUN(POSTGRESQL_CHECKS, [
> 	AC_SUBST(PQINCPATH)
> 	AC_SUBST(PQLIB)
> 
> echo Checking if PostgreSQL is available
> 
> dnl Check for PQLIB first.
> AC_CHECK_LIB(pq,PQconnectdb,FOUND_PQLIB=1)
> if test $FOUND_PQLIB ; then
> 	PQLIB="-lpq"
> else
> 	echo PostgreSQL library not found in default library path.
> 	exit 0
> fi
> 
> dnl Check for PQINCPATH
> if test -d /usr/include/pgsql ; then
> 	pg_inc_dir="/usr/include/pgsql"
> elif test -d /usr/include/postgresql ; then
> 	pg_inc_dir="/usr/include/postgresql"
> elif test -d /usr/local/psql/include ; then
> 	pg_inc_dir="/usr/local/psql/include"
> elif test -d /opt/psql/include ; then
> 	pg_inc_dir="/opt/psql/include"
> else
> 	echo PostgreSQL includes directory not found!
> 	PQLIB=""
> 	exit 0
> fi
> 
> dnl Check for libpq-fe.h
> AC_CHECK_HEADERS("$pg_inc_dir/libpq-fe.h")
> if test $HAVE_HEADER-LIBPQ-FE.H ; then
> 	PQINCPATH="-I$pg_inc_dir"
> else
> 	echo PostgreSQL header libpq-fe.h not found!
> 	PQLIB=""
> 	exit 0
> fi
> 
> echo PostgreSQL configuration successful.
> ])
> </postgresql.m4>


-- 
/bin/sh ~/.signature:
Command not found

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list