[Freeswitch-users] configure fails to find libpq

Claus Andersen clan at wheel.dk
Thu Jun 13 15:34:58 MSD 2013


Hi,

I am having trouble enabling pgsql support with the configure script and I 
will almost (boldly!) claim there might be a problem we the configure 
script. Autoconf and friends is however close to black magic and voodoo so 
I will try to assert my viewpoint and hopefully someone can point out my 
level of cluelessness :-)

I am able to compile and run Freeswitch 1.2.8 (without core-pgsql), 
PostgreSQL 9.2.4 and OpenResty 1.2.8.5 (with libpq!).

Openresty was configured with:
./configure --with-luajit --with-http_iconv_module 
--with-http_postgres_module --with-libpq=/usr/pgsql-9.2

Hence I know that I have a recent and working libpq. From previous mails 
on this list I can see that is the typical response to this issue is to 
install postgresql92-devel which I have already done.

However freeswitch configure fails:

$ ./configure --enable-core-pgsql-support
<snip>
checking for odbc header in /usr/include... found
checking for SQLDisconnect in -lodbc... yes
checking whether to include odbc... yes
checking for SQLDisconnect in -lodbc... (cached) yes
checking for pg_config... /usr/pgsql-9.2/bin/pg_config
checking for PostgreSQL libraries... checking for PQgetvalue in -lpq... no
configure: error: no usable libpq; please install PostgreSQL devel package 
or equivalent

The part of configure which fails is:

{ $as_echo "$as_me:$LINENO: checking for PQgetvalue in -lpq" >&5
$as_echo_n "checking for PQgetvalue in -lpq... " >&6; }
if test "${ac_cv_lib_pq_PQgetvalue+set}" = set; then
   $as_echo_n "(cached) " >&6
else
   ac_check_lib_save_LIBS=$LIBS
LIBS="-lpq  $LIBS"

I do simply not understand what "${ac_cv_lib_pq_PQgetvalue+set}" actually 
is doing and it becomes a dark art for me. If I remove the "if" clause I 
assume things would simply work (as LIBS should be correct)!

My initial thought was to try to make an addition to configure to support 
the following options:
   --with-pgsql-lib=dir
   --with-pqsql-include=dir

My OCD does however not like that I do not understand the test performed 
today. To blindly add those options would be too hackish (and stoopid).

Can anyone explain what happens in the configure script? I would rather 
spend some time making sure configure works perfectly rather than tweaking 
my environment to match the expectations of the script.

Kind Regards,
Claus Andersen

Additional info:

Freeswitch 1.2.8 with PostgreSQL 9.2.4

uname -m = x86_64
uname -r = 2.6.32-358.6.1.el6.x86_64
uname -s = Linux
uname -v = #1 SMP Tue Apr 23 19:29:00 UTC 2013

$ grep PQgetvalue /usr/pgsql-9.2/include/libpq-fe.h
extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);

$ pg_config (excerpt)
INCLUDEDIR = /usr/pgsql-9.2/include
LIBDIR = /usr/pgsql-9.2/lib
LDFLAGS = -L/usr/lib64 -Wl,--as-needed
LIBS = -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz 
-lreadline -lcrypt -ldl -lm
VERSION = PostgreSQL 9.2.4

$ tail config.log
#define HAVE_ODBC 1
#define HAVE_LIBODBC 1
#define SWITCH_HAVE_PGSQL 1
#define POSTGRESQL_VERSION "9.2.4"
#define POSTGRESQL_MAJOR_VERSION 9
#define POSTGRESQL_MINOR_VERSION 2
#define POSTGRESQL_PATCH_VERSION 4

configure: exit 1

$ rpm -ql postgresql92-devel | grep libpq
/usr/pgsql-9.2/include/internal/libpq
/usr/pgsql-9.2/include/internal/libpq-int.h
/usr/pgsql-9.2/include/internal/libpq/pqcomm.h
/usr/pgsql-9.2/include/libpq
/usr/pgsql-9.2/include/libpq-events.h
/usr/pgsql-9.2/include/libpq-fe.h
/usr/pgsql-9.2/include/libpq/libpq-fs.h
/usr/pgsql-9.2/include/server/libpq
/usr/pgsql-9.2/include/server/libpq/auth.h
/usr/pgsql-9.2/include/server/libpq/be-fsstubs.h
/usr/pgsql-9.2/include/server/libpq/crypt.h
/usr/pgsql-9.2/include/server/libpq/hba.h
/usr/pgsql-9.2/include/server/libpq/ip.h
/usr/pgsql-9.2/include/server/libpq/libpq-be.h
/usr/pgsql-9.2/include/server/libpq/libpq-fs.h
/usr/pgsql-9.2/include/server/libpq/libpq.h
/usr/pgsql-9.2/include/server/libpq/md5.h
/usr/pgsql-9.2/include/server/libpq/pqcomm.h
/usr/pgsql-9.2/include/server/libpq/pqformat.h
/usr/pgsql-9.2/include/server/libpq/pqsignal.h
/usr/pgsql-9.2/lib/libpq.a
/usr/pgsql-9.2/lib/libpq.so



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list