From bb84b0534c0805f82d6a35b9fca9f33c29287e82 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 10 Sep 2014 22:03:29 +0000 Subject: [PATCH] Check for libpq in core before building mod_cdr_pg_csv --- configure.ac | 3 +++ src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index e8f9efade0..dbb5a925f2 100644 --- a/configure.ac +++ b/configure.ac @@ -601,6 +601,7 @@ if test x"$enable_core_pgsql_support" = x"yes" ; then AC_MSG_RESULT([$POSTGRESQL_LIBDIR]) AC_DEFINE([SWITCH_HAVE_PGSQL], [1], [Define to 1 if PostgreSQL libraries are available]) + AM_CONDITIONAL([HAVE_PGSQL],[true]) AC_DEFINE_UNQUOTED([POSTGRESQL_VERSION], "${POSTGRESQL_VERSION}", [Specifies the version of PostgreSQL we are linking against]) AC_DEFINE_UNQUOTED([POSTGRESQL_MAJOR_VERSION], ${POSTGRESQL_MAJOR_VERSION}, [Specifies the version of PostgreSQL we are linking against]) AC_DEFINE_UNQUOTED([POSTGRESQL_MINOR_VERSION], ${POSTGRESQL_MINOR_VERSION}, [Specifies the version of PostgreSQL we are linking against]) @@ -612,6 +613,8 @@ if test x"$enable_core_pgsql_support" = x"yes" ; then SWITCH_AM_LDFLAGS="$POSTGRESQL_LDFLAGS $SWITCH_AM_LDFLAGS" LIBS="$save_LIBS" +else + AM_CONDITIONAL([HAVE_PGSQL],[false]) fi AC_ARG_ENABLE(deprecated-core-db-events, diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am b/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am index bcbfada1cf..7c37b89630 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am +++ b/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am @@ -1,8 +1,17 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_cdr_pg_csv +if HAVE_PGSQL + mod_LTLIBRARIES = mod_cdr_pg_csv.la mod_cdr_pg_csv_la_SOURCES = mod_cdr_pg_csv.c mod_cdr_pg_csv_la_CFLAGS = $(AM_CFLAGS) $(SWITCH_AM_CXXFLAGS) mod_cdr_pg_csv_la_LIBADD = $(switch_builddir)/libfreeswitch.la mod_cdr_pg_csv_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lpq $(SWITCH_AM_LDFLAGS) + +else +install: error +all: error +error: + $(error You must configure --enable-core-pgsql-support to build this module) +endif