File: ms_check_pgsql_db.m4

package info (click to toggle)
autoconf-archive 20041123-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,336 kB
  • ctags: 2
  • sloc: makefile: 29
file content (31 lines) | stat: -rw-r--r-- 770 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/ms_check_pgsql_db.html
dnl
AC_DEFUN([MS_CHECK_PGSQL_DB], [
AC_REQUIRE([MS_PROG_PGCLIENT])
AC_MSG_CHECKING([for PostgreSQL db $1 (user: $2, host: $3)])

pgclient_call="$pgclient"

if test "x$1" != "x"; then
        pgclient_call="$pgclient_call dbname=$1";
fi
if test "x$2" != "x"; then
        pgclient_call="$pgclient_call user=$2";
fi
if test "x$3" != "x"; then
        pgclient_call="$pgclient_call host=$3";
fi
if test "x$4" != "x"; then
        pgclient_call="$pgclient_call password=$4";
fi

$pgclient_call -c 'SELECT 1' > /dev/null 2>&1
if test "x$?" = "x0"; then
        AC_MSG_RESULT([yes])
        $6
else
        AC_MSG_RESULT([no])
        $5
fi;
])dnl