dnl This is a based file from mysql.m4 AC_DEFUN([AX_LIB_PGSQL], [ AC_ARG_WITH([pgsql], AC_HELP_STRING([--with-pgsql=@<:@ARG@:>@], [use PostgreSQL client library @<:@default=no@:>@, optionally specify path to pg_config] ), [ if test "$withval" = "no"; then want_pgsql="no" elif test "$withval" = "yes"; then want_pgsql="yes" else want_pgsql="yes" PGSQL_CONFIG="$withval" fi ], [want_pgsql="yes"] ) PGSQL_CFLAGS="" PGSQL_LDFLAGS="" PGSQL_VERSION="" dnl dnl Check PGSQL libraries (libpq) dnl if test "$want_pgsql" = "yes"; then if test -z "$PGSQL_CONFIG" -o test; then AC_PATH_PROG([PGSQL_CONFIG], [pg_config], [no]) fi if test "$PGSQL_CONFIG" != "no"; then AC_MSG_CHECKING([for PostgreSQL libraries]) PGSQL_CFLAGS="`$PGSQL_CONFIG --cflags`" PGSQL_LDFLAGS="`$PGSQL_CONFIG --libs` -lpq" PGSQL_VERSION="`$PGSQL_CONFIG --version | cut -d \" \" -f 2`" found_pgsql="yes" AC_MSG_RESULT([yes]) fi fi dnl dnl Check if required version of PGSQL is available dnl AC_MSG_RESULT([$PGSQL_VERSION]) pgsql_version_req=ifelse([$1], [], [], [$1]) if test "$found_pgsql" = "yes" -a -n "$pgsql_version_req"; then AC_MSG_CHECKING([if PostgreSQL version is >= $pgsql_version_req]) dnl Decompose required version string of PostgreSQL dnl and calculate its number representation pgsql_version_req_major=`expr $pgsql_version_req : '\([[0-9]]*\)'` pgsql_version_req_minor=`expr $pgsql_version_req : '[[0-9]]*\.\([[0-9]]*\)'` pgsql_version_req_micro=`expr $pgsql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$pgsql_version_req_micro" = "x"; then pgsql_version_req_micro="0" fi pgsql_version_req_number=`expr $pgsql_version_req_major \* 1000000 \ \+ $pgsql_version_req_minor \* 1000 \ \+ $pgsql_version_req_micro` dnl Decompose version string of installed PostgreSQL dnl and calculate its number representation pgsql_version_major=`expr $PGSQL_VERSION : '\([[0-9]]*\)'` pgsql_version_minor=`expr $PGSQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'` pgsql_version_micro=`expr $PGSQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$pgsql_version_micro" = "x"; then pgsql_version_micro="0" fi dnl AC_MSG_CHECKING([ no problemas en version]) pgsql_version_number=`expr $pgsql_version_major \* 1000000 \ \+ $pgsql_version_minor \* 1000 \ \+ $pgsql_version_micro` pgsql_version_check=`expr $pgsql_version_number \>\= $pgsql_version_req_number` if test "$pgsql_version_check" = "1"; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi fi if test "$found_pgsql $pgsql_version_check" = "yes 1"; then have_pgsql="yes" else have_pgsql="no" fi AM_CONDITIONAL(HAVE_PGSQL, test $have_pgsql = "yes") AC_SUBST([PGSQL_VERSION]) AC_SUBST([PGSQL_CFLAGS]) AC_SUBST([PGSQL_LDFLAGS]) ])