summaryrefslogtreecommitdiff
path: root/build-postgresql
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2018-06-11 21:39:55 +0200
committerPeter Bex <peter@more-magic.net>2018-06-11 21:56:43 +0200
commit385f6f23fee37617e0148babdb00783775d04a70 (patch)
tree6175f6364667fba196f83bcc328a38f626ee5be0 /build-postgresql
downloadchicken-postgresql-4.0.0.tar.gz
Initial port of PostgreSQL egg to CHICKEN 54.0.0
Diffstat (limited to 'build-postgresql')
-rwxr-xr-xbuild-postgresql23
1 files changed, 23 insertions, 0 deletions
diff --git a/build-postgresql b/build-postgresql
new file mode 100755
index 0000000..fb15976
--- /dev/null
+++ b/build-postgresql
@@ -0,0 +1,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" "$@"