summaryrefslogtreecommitdiff
path: root/build-postgresql
blob: fb1597669822145be2640d9b014f532e78fcf9bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- sh -*-

# Determine if pkg-config exists and knows about libpq, otherwise
# fall back on pg_config to determine compiler and linker flags.
if pkg-config --exists libpq >/dev/null 2>/dev/null; then
   CFLAGS="`pkg-config --cflags libpq`"
   LDFLAGS="`pkg-config --libs libpq`"
else
   CFLAGS="-I`pg_config --includedir`"
   LDFLAGS="-L`pg_config --libdir` -Wl,-rpath `pg_config --libdir` -lpq"
fi

known_features="escape-identifier connectdb-params diag-query-position diag-schema-info"

feature_flags=""
for feature in $known_features; do
    if "$CHICKEN_CSC" -C "$CFLAGS" -L "$LDFLAGS" "feature-tests/$feature.c" >/dev/null 2>/dev/null; then
	feature_flags="$feature_flags -Dhas-$feature"
    fi
    rm -f feature-tests/$feature.o feature-tests/$feature
done

"$CHICKEN_CSC" $feature_flags -C "$CFLAGS" -L "$LDFLAGS" "$@"