FS-5512 --resolve ; clean up PostgreSQL libpq client detection in configure
Clean up the libpq autodection and make sure it functionswith both pg_config and pkg-config. if you are installing into a non-FHS standard location such as what happens with RPMs from the Postgres yum repo, you will need to make sure pkg-config can fild the libpq.pc file. example: export PKG_CONFIG_PATH=/usr/pgsql-9.3/lib/pkgconfig you may also want to make sure your path can find pg_config example: export PATH=/usr/pgsql-9.3/bin:$PATH
This commit is contained in:
parent
2907a4824f
commit
81185aa9b7
39
configure.in
39
configure.in
|
@ -1,4 +1,5 @@
|
|||
# -*- Autoconf -*-
|
||||
>>>>>>> 1a85246... svn has been long retired
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Must change all of the below together
|
||||
|
@ -425,39 +426,47 @@ AC_ARG_ENABLE(core-pgsql-pkgconfig,
|
|||
if test x"$enable_core_pgsql_support" = x"yes" ; then
|
||||
AC_PATH_PROG([PG_CONFIG], [pg_config], [no])
|
||||
AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
|
||||
if test "$PG_CONFIG" = "no"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_FAILURE([Unabled to find pg_config in PATH. Is PostgreSQL installed?])
|
||||
else
|
||||
if test "$PKG_CONFIG" = "no" \
|
||||
|| test x"$enable_core_pgsql_pkgconfig" = x"no" \
|
||||
|| ! pkg-config libpq; then
|
||||
AC_MSG_CHECKING([for PostgreSQL libraries])
|
||||
POSTGRESQL_CXXFLAGS="`$PG_CONFIG --cppflags` -I`$PG_CONFIG --includedir`"
|
||||
POSTGRESQL_LDFLAGS="`$PG_CONFIG --ldflags|sed 's/ -Wl,--as-needed//g'` -L`$PG_CONFIG --libdir` -lpq"
|
||||
POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'`
|
||||
POSTGRESQL_MAJOR_VERSION=`$PG_CONFIG --version | sed -e 's/devel//' | sed -re 's#PostgreSQL ([0-9]+).[0-9]+.?[0-9]+?#\1#'`
|
||||
POSTGRESQL_MINOR_VERSION=`$PG_CONFIG --version | sed -e 's/devel//' | sed -re 's#PostgreSQL [0-9]+.([0-9]+).?[0-9]+?#\1#'`
|
||||
POSTGRESQL_PATCH_VERSION=`$PG_CONFIG --version | sed -e 's/devel//' | sed -re 's#PostgreSQL [0-9]+.[0-9]+.?([0-9]+)?#\1#'`
|
||||
if test "$PG_CONFIG" != "no"; then
|
||||
AC_MSG_CHECKING([for PostgreSQL libraries via pg_config])
|
||||
POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
|
||||
POSTGRESQL_LIBDIR="-L`$PG_CONFIG --libdir`"
|
||||
POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq"
|
||||
POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'`
|
||||
POSTGRESQL_MAJOR_VERSION=`$PG_CONFIG --version | sed -e 's/devel//' | sed -re 's#PostgreSQL ([0-9]+).[0-9]+.?[0-9]+?#\1#'`
|
||||
POSTGRESQL_MINOR_VERSION=`$PG_CONFIG --version | sed -e 's/devel//' | sed -re 's#PostgreSQL [0-9]+.([0-9]+).?[0-9]+?#\1#'`
|
||||
POSTGRESQL_PATCH_VERSION=`$PG_CONFIG --version | sed -e 's/devel//' | sed -re 's#PostgreSQL [0-9]+.[0-9]+.?([0-9]+)?#\1#'`
|
||||
else
|
||||
AC_MSG_ERROR([no usable pkg-config or pg_config; please install libpq devel package or equivalent])
|
||||
fi
|
||||
else
|
||||
AC_MSG_CHECKING([for PostgreSQL libraries])
|
||||
POSTGRESQL_CXXFLAGS="`$PKG_CONFIG --cflags libpq`"
|
||||
AC_MSG_CHECKING([for PostgreSQL libraries via pkg_config])
|
||||
POSTGRESQL_CFLAGS="`$PKG_CONFIG --cflags libpq`"
|
||||
POSTGRESQL_LIBDIR="`$PKG_CONFIG libpq --libs-only-L`"
|
||||
POSTGRESQL_LDFLAGS="`$PKG_CONFIG --libs libpq`"
|
||||
POSTGRESQL_VERSION="`$PKG_CONFIG --modversion libpq`"
|
||||
POSTGRESQL_MAJOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f1`"
|
||||
POSTGRESQL_MINOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f2`"
|
||||
POSTGRESQL_PATCH_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f3`"
|
||||
fi
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$POSTGRESQL_LIBDIR $LIBS"
|
||||
AC_MSG_RESULT([$POSTGRESQL_LIBDIR])
|
||||
|
||||
AC_DEFINE([SWITCH_HAVE_PGSQL], [1], [Define to 1 if PostgreSQL libraries are available])
|
||||
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])
|
||||
AC_DEFINE_UNQUOTED([POSTGRESQL_PATCH_VERSION], ${POSTGRESQL_PATCH_VERSION}, [Specifies the version of PostgreSQL we are linking against])
|
||||
|
||||
AC_CHECK_LIB([pq], [PQgetvalue],, AC_MSG_ERROR([no usable libpq; please install PostgreSQL devel package or equivalent]))
|
||||
AC_MSG_RESULT([yes])
|
||||
SWITCH_AM_CXXFLAGS="$POSTGRESQL_CXXFLAGS $SWITCH_AM_CXXFLAGS"
|
||||
SWITCH_AM_CXXFLAGS="$POSTGRESQL_CFLAGS $SWITCH_AM_CXXFLAGS"
|
||||
SWITCH_AM_LDFLAGS="$POSTGRESQL_LDFLAGS $SWITCH_AM_LDFLAGS"
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(deprecated-core-db-events,
|
||||
|
|
Loading…
Reference in New Issue