Debian Codegraph @

pg_config

raw
1 #!/bin/sh
2
3 # If postgresql-server-dev-* is installed, call pg_config from the latest
4 # available one. Otherwise fall back to libpq-dev's version.
5 #
6 # (C) 2011 Martin Pitt <[email protected]>
7 # (C) 2014-2018 Christoph Berg <[email protected]>
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18
19 set -e
20 PGBINROOT="/usr/lib/postgresql/"
21 #redhat# PGBINROOT="/usr/pgsql-"
22 LATEST_SERVER_DEV=`ls -v $PGBINROOT*/bin/pg_config 2>/dev/null|tail -n1`
23
24 if [ -n "$LATEST_SERVER_DEV" ]; then
25 exec "$LATEST_SERVER_DEV" "$@"
26 else
27 if [ -x /usr/bin/pg_config.libpq-dev ]; then
28 exec /usr/bin/pg_config.libpq-dev "$@"
29 else
30 echo "You need to install postgresql-server-dev-NN for building a server-side extension or libpq-dev for building a client-side application." >&2
31 exit 1
32 fi
33 fi