From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-odbc@postgresql.org
Subject: Using pg_config
Date: Tue, 11 Oct 2005 11:16:50 +0200
Message-ID: <200510111116.50621.peter_e@gmx.net> (raw)
I was unable to build the libpq-based driver because it apparently makes some
hard-coded assumptions about the installation paths which did not work on my
system. It'd be better if pg_config were used to detect the installation
paths. I've attached a patch for that here. I'm not sure how that works on
Windows, though. Comments?
--
Peter Eisentraut
http://developer.postgresql.org/~petere/Attachments:psqlodbc-pgconfig.patch (text/x-diff, 3.4K) download
diff -cr ../cvs-psqlodbc/configure.ac ./configure.ac
*** ../cvs-psqlodbc/configure.ac 2005-09-19 15:31:58.000000000 +0200
--- ./configure.ac 2005-10-11 11:07:00.000000000 +0200
***************
*** 118,208 ****
AC_TYPE_SIZE_T
AC_STRUCT_TM
- - #- #Options for pgsql headers and libraries- #- - AC_MSG_CHECKING(for pgsql include files)- AC_ARG_WITH(pgsql-include,- [ --with-pgsql-include=DIR Look for postgreSQL include files in DIR],- [if test "$withval" != no; then- AC_MSG_RESULT(yes)- pgsql_include="$withval"- else- AC_MSG_RESULT(no)- AC_MSG_ERROR([you must specify a directory when using --with-pgsql-include=DIR])- fi])
#
! # Library directories
#
! AC_MSG_CHECKING(for pgsql)
! AC_ARG_WITH(pgsql,
! [ --with-pgsql=DIR look for PostgreSQL libraries and headers in DIR],
! [if test "$withval" != no
! then
! AC_MSG_RESULT(yes)
! LIBPQ_HOME="$withval"
! else
! AC_MSG_RESULT(no)
! fi], [
! AC_MSG_RESULT(yes)
! LIBPQ_HOME="/usr/local/pgsql"
! if test "$pgsql_include" = ""
! then
! if test ! -f "${LIBPQ_HOME}/include/libpq-fe.h"
! then
! LIBPQ_HOME=/usr/local
! if test ! -f "${LIBPQ_HOME}/include/libpq-fe.h"
! then
! LIBPQ_HOME=/usr
! fi
! fi
! if test -f "/usr/include/libpq-fe.h"
! then
! pgsql_include="/usr/include"
! else
! if test -f "/usr/include/pgsql/libpq-fe.h"
! then
! pgsql_include="/usr/include/pgsql"
! fi
! fi
fi
! ])
! #
! # Check for libpq libraries and headers
! #
! if test -n "${LIBPQ_HOME}"
! then
! OLD_LDFLAGS="$LDFLAGS"
! OLD_CPPFLAGS="$CPPFLAGS"
! LDFLAGS="$LDFLAGS -L${LIBPQ_HOME}/lib"
! AC_CHECK_LIB(pq, PQexec, [pgsql_cv_libpq=yes], [pgsql_cv_libpq=no])
- if test "$pgsql_include" != ""- then- CPPFLAGS="$CPPFLAGS -I${pgsql_include}"- else- CPPFLAGS="$CPPFLAGS -I${LIBPQ_HOME}/include"- fi- AC_CHECK_HEADER(libpq-fe.h, [pgsql_cv_libpqfe_h=yes], [pgsql_cv_libpqfe_h=no])- - if test "$pgsql_cv_libpq" = "yes" -a "$pgsql_cv_libpqfe_h" = "yes"- then- AC_MSG_CHECKING(pgsql in ${LIBPQ_HOME})- AC_MSG_RESULT(ok)- else- AC_MSG_CHECKING(pgsql in ${LIBPQ_HOME})- AC_MSG_RESULT(failed)- LDFLAGS="$OLD_LDFLAGS"- CPPFLAGS="$OLD_CPPFLAGS"- AC_MSG_ERROR([you must specify a valid pgsql installation with --with-pgsql=DIR])- fi- LIBS="$LIBS -lpq"- CPPFLAGS="$CPPFLAGS "- - fi
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
--- 118,136 ----
AC_TYPE_SIZE_T
AC_STRUCT_TM
#
! # Find libpq headers and libraries
#
! AC_PATH_PROGS(PG_CONFIG, pg_config)
! if test -z "$PG_CONFIG" ; then
! AC_MSG_ERROR([pg_config not found])
fi
! pg_includedir=`$PG_CONFIG --includedir`
! pg_libdir=`$PG_CONFIG --libdir`
! CPPFLAGS="$CPPFLAGS -I$pg_includedir"
! LDFLAGS="$LDFLAGS -L$pg_libdir"
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff -cr ../cvs-psqlodbc/Makefile.am ./Makefile.am
*** ../cvs-psqlodbc/Makefile.am 2005-09-19 15:31:58.000000000 +0200
--- ./Makefile.am 2005-10-11 10:49:51.000000000 +0200
***************
*** 12,17 ****
--- 12,19 ----
psqlodbc_la_LDFLAGS = -module -no-undefined -avoid-version
+ psqlodbc_la_LIBADD = -lpq+
psqlodbc_la_SOURCES = \
info.c bind.c columninfo.c connection.c convert.c drvconn.c \
environ.c execute.c win_md5.c misc.c options.c \
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: peter_e@gmx.net
Subject: Re: Using pg_config
In-Reply-To: <200510111116.50621.peter_e@gmx.net>
References: <200510111116.50621.peter_e@gmx.net>
* 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