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 32 33
|
dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/ms_pgsql_priv_root.html
dnl
AC_DEFUN([MS_CHECK_PGSQL_PRIV_ROOT], [
AC_REQUIRE([MS_PROG_PGCLIENT])dnl
AC_REQUIRE([MS_CHECK_PGSQL_DB])dnl
AC_MSG_CHECKING([if PostgreSQL user $2 has root privileges])
pgclient_root_call="$pgclient"
if test "x$1" != "x"; then
pgclient_root_call="$pgclient_root_call dbname=$1";
fi
if test "x$2" != "x"; then
pgclient_root_call="$pgclient_root_call user=$2";
fi
if test "x$3" != "x"; then
pgclient_root_call="$pgclient_root_call host=$3";
fi
if test "x$4" != "x"; then
pgclient_root_call="$pgclient_root_call password=$4";
fi
testdb="test`date +%s`"
echo "CREATE DATABASE $testdb; DROP DATABASE $testdb;" | $pgclient_root_call > /dev/null 2>&1
if test "x$?" = "x0"; then
AC_MSG_RESULT([yes])
$6
else
AC_MSG_RESULT([no])
$5
fi;
])dnl
|